/******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ({

/***/ 2790:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

var categories = [__webpack_require__(9624), __webpack_require__(7366), __webpack_require__(3368), __webpack_require__(8737), __webpack_require__(2711), __webpack_require__(2328), __webpack_require__(3286), __webpack_require__(4405), __webpack_require__(4589), __webpack_require__(7092), __webpack_require__(8572), __webpack_require__(8097)];
for (var c in categories) {
  var category = categories[c];
  for (var f in category) {
    exports[f] = exports[f] || category[f];
  }
}

/***/ }),

/***/ 9624:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

var mathTrig = __webpack_require__(2711);
var statistical = __webpack_require__(8572);
var engineering = __webpack_require__(3368);
var dateTime = __webpack_require__(3286);
function set(fn, root) {
  if (root) {
    for (var i in root) {
      fn[i] = root[i];
    }
  }
  return fn;
}
exports.BETADIST = statistical.BETA.DIST;
exports.BETAINV = statistical.BETA.INV;
exports.BINOMDIST = statistical.BINOM.DIST;
exports.CEILING = exports.ISOCEILING = set(mathTrig.CEILING.MATH, mathTrig.CEILING);
exports.CEILINGMATH = mathTrig.CEILING.MATH;
exports.CEILINGPRECISE = mathTrig.CEILING.PRECISE;
exports.CHIDIST = statistical.CHISQ.DIST;
exports.CHIDISTRT = statistical.CHISQ.DIST.RT;
exports.CHIINV = statistical.CHISQ.INV;
exports.CHIINVRT = statistical.CHISQ.INV.RT;
exports.CHITEST = statistical.CHISQ.TEST;
exports.CONFIDENCE = set(statistical.CONFIDENCE.NORM, statistical.CONFIDENCE);
exports.COVAR = statistical.COVARIANCE.P;
exports.COVARIANCEP = statistical.COVARIANCE.P;
exports.COVARIANCES = statistical.COVARIANCE.S;
exports.CRITBINOM = statistical.BINOM.INV;
exports.EXPONDIST = statistical.EXPON.DIST;
exports.ERFCPRECISE = engineering.ERFC.PRECISE;
exports.ERFPRECISE = engineering.ERF.PRECISE;
exports.FDIST = statistical.F.DIST;
exports.FDISTRT = statistical.F.DIST.RT;
exports.FINVRT = statistical.F.INV.RT;
exports.FINV = statistical.F.INV;
exports.FLOOR = set(mathTrig.FLOOR.MATH, mathTrig.FLOOR);
exports.FLOORMATH = mathTrig.FLOOR.MATH;
exports.FLOORPRECISE = mathTrig.FLOOR.PRECISE;
exports.FTEST = statistical.F.TEST;
exports.GAMMADIST = statistical.GAMMA.DIST;
exports.GAMMAINV = statistical.GAMMA.INV;
exports.GAMMALNPRECISE = statistical.GAMMALN.PRECISE;
exports.HYPGEOMDIST = statistical.HYPGEOM.DIST;
exports.LOGINV = statistical.LOGNORM.INV;
exports.LOGNORMINV = statistical.LOGNORM.INV;
exports.LOGNORMDIST = statistical.LOGNORM.DIST;
exports.MODE = set(statistical.MODE.SNGL, statistical.MODE);
exports.MODEMULT = statistical.MODE.MULT;
exports.MODESNGL = statistical.MODE.SNGL;
exports.NEGBINOMDIST = statistical.NEGBINOM.DIST;
exports.NETWORKDAYSINTL = dateTime.NETWORKDAYS.INTL;
exports.NORMDIST = statistical.NORM.DIST;
exports.NORMINV = statistical.NORM.INV;
exports.NORMSDIST = statistical.NORM.S.DIST;
exports.NORMSINV = statistical.NORM.S.INV;
exports.PERCENTILE = set(statistical.PERCENTILE.EXC, statistical.PERCENTILE);
exports.PERCENTILEEXC = statistical.PERCENTILE.EXC;
exports.PERCENTILEINC = statistical.PERCENTILE.INC;
exports.PERCENTRANK = set(statistical.PERCENTRANK.INC, statistical.PERCENTRANK);
exports.PERCENTRANKEXC = statistical.PERCENTRANK.EXC;
exports.PERCENTRANKINC = statistical.PERCENTRANK.INC;
exports.POISSON = set(statistical.POISSON.DIST, statistical.POISSON);
exports.POISSONDIST = statistical.POISSON.DIST;
exports.QUARTILE = set(statistical.QUARTILE.INC, statistical.QUARTILE);
exports.QUARTILEEXC = statistical.QUARTILE.EXC;
exports.QUARTILEINC = statistical.QUARTILE.INC;
exports.RANK = set(statistical.RANK.EQ, statistical.RANK);
exports.RANKAVG = statistical.RANK.AVG;
exports.RANKEQ = statistical.RANK.EQ;
exports.SKEWP = statistical.SKEW.P;
exports.STDEV = set(statistical.STDEV.S, statistical.STDEV);
exports.STDEVP = statistical.STDEV.P;
exports.STDEVS = statistical.STDEV.S;
exports.TDIST = statistical.T.DIST;
exports.TDISTRT = statistical.T.DIST.RT;
exports.TINV = statistical.T.INV;
exports.TTEST = statistical.T.TEST;
exports.VAR = set(statistical.VAR.S, statistical.VAR);
exports.VARP = statistical.VAR.P;
exports.VARS = statistical.VAR.S;
exports.WEIBULL = set(statistical.WEIBULL.DIST, statistical.WEIBULL);
exports.WEIBULLDIST = statistical.WEIBULL.DIST;
exports.WORKDAYINTL = dateTime.WORKDAY.INTL;
exports.ZTEST = statistical.Z.TEST;

/***/ }),

/***/ 7366:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

var error = __webpack_require__(5734);
var stats = __webpack_require__(8572);
var maths = __webpack_require__(2711);
var utils = __webpack_require__(2593);
var evalExpression = __webpack_require__(2933);
function compact(array) {
  var result = [];
  utils.arrayEach(array, function (value) {
    if (value) {
      result.push(value);
    }
  });
  return result;
}
exports.FINDFIELD = function (database, title) {
  var index = null;
  utils.arrayEach(database, function (value, i) {
    if (value[0] === title) {
      index = i;
      return false;
    }
  });

  // Return error if the input field title is incorrect
  if (index == null) {
    return error.value;
  }
  return index;
};
function findResultIndex(database, criterias) {
  var matches = {};
  for (var i = 1; i < database[0].length; ++i) {
    matches[i] = true;
  }
  var maxCriteriaLength = criterias[0].length;
  for (i = 1; i < criterias.length; ++i) {
    if (criterias[i].length > maxCriteriaLength) {
      maxCriteriaLength = criterias[i].length;
    }
  }
  for (var k = 1; k < database.length; ++k) {
    for (var l = 1; l < database[k].length; ++l) {
      var currentCriteriaResult = false;
      var hasMatchingCriteria = false;
      for (var j = 0; j < criterias.length; ++j) {
        var criteria = criterias[j];
        if (criteria.length < maxCriteriaLength) {
          continue;
        }
        var criteriaField = criteria[0];
        if (database[k][0] !== criteriaField) {
          continue;
        }
        hasMatchingCriteria = true;
        for (var p = 1; p < criteria.length; ++p) {
          if (!currentCriteriaResult) {
            var isWildcard = criteria[p] === void 0 || criteria[p] === '*';
            if (isWildcard) {
              currentCriteriaResult = true;
            } else {
              var tokenizedCriteria = evalExpression.parse(criteria[p] + '');
              var tokens = [evalExpression.createToken(database[k][l], evalExpression.TOKEN_TYPE_LITERAL)].concat(tokenizedCriteria);
              currentCriteriaResult = evalExpression.compute(tokens);
            }
          }
        }
      }
      if (hasMatchingCriteria) {
        matches[l] = matches[l] && currentCriteriaResult;
      }
    }
  }
  var result = [];
  for (var n = 0; n < database[0].length; ++n) {
    if (matches[n]) {
      result.push(n - 1);
    }
  }
  return result;
}

// Database functions
exports.DAVERAGE = function (database, field, criteria) {
  // Return error if field is not a number and not a string
  if (isNaN(field) && typeof field !== "string") {
    return error.value;
  }
  var resultIndexes = findResultIndex(database, criteria);
  var targetFields = [];
  if (typeof field === "string") {
    var index = exports.FINDFIELD(database, field);
    targetFields = utils.rest(database[index]);
  } else {
    targetFields = utils.rest(database[field]);
  }
  var sum = 0;
  utils.arrayEach(resultIndexes, function (value) {
    sum += targetFields[value];
  });
  return resultIndexes.length === 0 ? error.div0 : sum / resultIndexes.length;
};
exports.DCOUNT = function (database, field, criteria) {
  // Return error if field is not a number and not a string
  if (isNaN(field) && typeof field !== "string") {
    return error.value;
  }
  var resultIndexes = findResultIndex(database, criteria);
  var targetFields = [];
  if (typeof field === "string") {
    var index = exports.FINDFIELD(database, field);
    targetFields = utils.rest(database[index]);
  } else {
    targetFields = utils.rest(database[field]);
  }
  var targetValues = [];
  utils.arrayEach(resultIndexes, function (value) {
    targetValues.push(targetFields[value]);
  });
  return stats.COUNT(targetValues);
};
exports.DCOUNTA = function (database, field, criteria) {
  // Return error if field is not a number and not a string
  if (isNaN(field) && typeof field !== "string") {
    return error.value;
  }
  var resultIndexes = findResultIndex(database, criteria);
  var targetFields = [];
  if (typeof field === "string") {
    var index = exports.FINDFIELD(database, field);
    targetFields = utils.rest(database[index]);
  } else {
    targetFields = utils.rest(database[field]);
  }
  var targetValues = [];
  utils.arrayEach(resultIndexes, function (value) {
    targetValues.push(targetFields[value]);
  });
  return stats.COUNTA(targetValues);
};
exports.DGET = function (database, field, criteria) {
  // Return error if field is not a number and not a string
  if (isNaN(field) && typeof field !== "string") {
    return error.value;
  }
  var resultIndexes = findResultIndex(database, criteria);
  var targetFields = [];
  if (typeof field === "string") {
    var index = exports.FINDFIELD(database, field);
    targetFields = utils.rest(database[index]);
  } else {
    targetFields = utils.rest(database[field]);
  }

  // Return error if no record meets the criteria
  if (resultIndexes.length === 0) {
    return error.value;
  }
  // Returns the #NUM! error value because more than one record meets the
  // criteria
  if (resultIndexes.length > 1) {
    return error.num;
  }
  return targetFields[resultIndexes[0]];
};
exports.DMAX = function (database, field, criteria) {
  // Return error if field is not a number and not a string
  if (isNaN(field) && typeof field !== "string") {
    return error.value;
  }
  var resultIndexes = findResultIndex(database, criteria);
  var targetFields = [];
  if (typeof field === "string") {
    var index = exports.FINDFIELD(database, field);
    targetFields = utils.rest(database[index]);
  } else {
    targetFields = utils.rest(database[field]);
  }
  var maxValue = targetFields[resultIndexes[0]];
  utils.arrayEach(resultIndexes, function (value) {
    if (maxValue < targetFields[value]) {
      maxValue = targetFields[value];
    }
  });
  return maxValue;
};
exports.DMIN = function (database, field, criteria) {
  // Return error if field is not a number and not a string
  if (isNaN(field) && typeof field !== "string") {
    return error.value;
  }
  var resultIndexes = findResultIndex(database, criteria);
  var targetFields = [];
  if (typeof field === "string") {
    var index = exports.FINDFIELD(database, field);
    targetFields = utils.rest(database[index]);
  } else {
    targetFields = utils.rest(database[field]);
  }
  var minValue = targetFields[resultIndexes[0]];
  utils.arrayEach(resultIndexes, function (value) {
    if (minValue > targetFields[value]) {
      minValue = targetFields[value];
    }
  });
  return minValue;
};
exports.DPRODUCT = function (database, field, criteria) {
  // Return error if field is not a number and not a string
  if (isNaN(field) && typeof field !== "string") {
    return error.value;
  }
  var resultIndexes = findResultIndex(database, criteria);
  var targetFields = [];
  if (typeof field === "string") {
    var index = exports.FINDFIELD(database, field);
    targetFields = utils.rest(database[index]);
  } else {
    targetFields = utils.rest(database[field]);
  }
  var targetValues = [];
  utils.arrayEach(resultIndexes, function (value) {
    targetValues.push(targetFields[value]);
  });
  targetValues = compact(targetValues);
  var result = 1;
  utils.arrayEach(targetValues, function (value) {
    result *= value;
  });
  return result;
};
exports.DSTDEV = function (database, field, criteria) {
  // Return error if field is not a number and not a string
  if (isNaN(field) && typeof field !== "string") {
    return error.value;
  }
  var resultIndexes = findResultIndex(database, criteria);
  var targetFields = [];
  if (typeof field === "string") {
    var index = exports.FINDFIELD(database, field);
    targetFields = utils.rest(database[index]);
  } else {
    targetFields = utils.rest(database[field]);
  }
  var targetValues = [];
  utils.arrayEach(resultIndexes, function (value) {
    targetValues.push(targetFields[value]);
  });
  targetValues = compact(targetValues);
  return stats.STDEV.S(targetValues);
};
exports.DSTDEVP = function (database, field, criteria) {
  // Return error if field is not a number and not a string
  if (isNaN(field) && typeof field !== "string") {
    return error.value;
  }
  var resultIndexes = findResultIndex(database, criteria);
  var targetFields = [];
  if (typeof field === "string") {
    var index = exports.FINDFIELD(database, field);
    targetFields = utils.rest(database[index]);
  } else {
    targetFields = utils.rest(database[field]);
  }
  var targetValues = [];
  utils.arrayEach(resultIndexes, function (value) {
    targetValues.push(targetFields[value]);
  });
  targetValues = compact(targetValues);
  return stats.STDEV.P(targetValues);
};
exports.DSUM = function (database, field, criteria) {
  // Return error if field is not a number and not a string
  if (isNaN(field) && typeof field !== "string") {
    return error.value;
  }
  var resultIndexes = findResultIndex(database, criteria);
  var targetFields = [];
  if (typeof field === "string") {
    var index = exports.FINDFIELD(database, field);
    targetFields = utils.rest(database[index]);
  } else {
    targetFields = utils.rest(database[field]);
  }
  var targetValues = [];
  utils.arrayEach(resultIndexes, function (value) {
    targetValues.push(targetFields[value]);
  });
  return maths.SUM(targetValues);
};
exports.DVAR = function (database, field, criteria) {
  // Return error if field is not a number and not a string
  if (isNaN(field) && typeof field !== "string") {
    return error.value;
  }
  var resultIndexes = findResultIndex(database, criteria);
  var targetFields = [];
  if (typeof field === "string") {
    var index = exports.FINDFIELD(database, field);
    targetFields = utils.rest(database[index]);
  } else {
    targetFields = utils.rest(database[field]);
  }
  var targetValues = [];
  utils.arrayEach(resultIndexes, function (value) {
    targetValues.push(targetFields[value]);
  });
  return stats.VAR.S(targetValues);
};
exports.DVARP = function (database, field, criteria) {
  // Return error if field is not a number and not a string
  if (isNaN(field) && typeof field !== "string") {
    return error.value;
  }
  var resultIndexes = findResultIndex(database, criteria);
  var targetFields = [];
  if (typeof field === "string") {
    var index = exports.FINDFIELD(database, field);
    targetFields = utils.rest(database[index]);
  } else {
    targetFields = utils.rest(database[field]);
  }
  var targetValues = [];
  utils.arrayEach(resultIndexes, function (value) {
    targetValues.push(targetFields[value]);
  });
  return stats.VAR.P(targetValues);
};

/***/ }),

/***/ 3286:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

var error = __webpack_require__(5734);
var utils = __webpack_require__(2593);
var d1900 = new Date(Date.UTC(1900, 0, 1));
var WEEK_STARTS = [undefined, 0, 1, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, 1, 2, 3, 4, 5, 6, 0];
var WEEK_TYPES = [[], [1, 2, 3, 4, 5, 6, 7], [7, 1, 2, 3, 4, 5, 6], [6, 0, 1, 2, 3, 4, 5], [], [], [], [], [], [], [], [7, 1, 2, 3, 4, 5, 6], [6, 7, 1, 2, 3, 4, 5], [5, 6, 7, 1, 2, 3, 4], [4, 5, 6, 7, 1, 2, 3], [3, 4, 5, 6, 7, 1, 2], [2, 3, 4, 5, 6, 7, 1], [1, 2, 3, 4, 5, 6, 7]];
var WEEKEND_TYPES = [[], [6, 0], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], undefined, undefined, undefined, [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]];
exports.DATE = function (year, month, day) {
  var result;
  year = utils.parseNumber(year);
  month = utils.parseNumber(month);
  day = utils.parseNumber(day);
  if (utils.anyIsError(year, month, day)) {
    result = error.value;
  } else if (year < 0 || month < 0 || day < 0) {
    result = error.num;
  } else {
    result = new Date(year, month - 1, day);
  }
  return result;
};
exports.DATEVALUE = function (date_text) {
  var modifier = 2;
  var date;
  if (typeof date_text !== 'string') {
    return error.value;
  }
  date = Date.parse(date_text);
  if (isNaN(date)) {
    return error.value;
  }
  if (date <= -2203891200000) {
    modifier = 1;
  }
  return Math.ceil((date - d1900) / 86400000) + modifier;
};
exports.DAY = function (serial_number) {
  var date = utils.parseDate(serial_number);
  if (date instanceof Error) {
    return date;
  }
  return date.getDate();
};
exports.DAYS = function (end_date, start_date) {
  end_date = utils.parseDate(end_date);
  start_date = utils.parseDate(start_date);
  if (end_date instanceof Error) {
    return end_date;
  }
  if (start_date instanceof Error) {
    return start_date;
  }
  return serial(end_date) - serial(start_date);
};
exports.DAYS360 = function (start_date, end_date, method) {
  method = utils.parseBool(method);
  start_date = utils.parseDate(start_date);
  end_date = utils.parseDate(end_date);
  if (start_date instanceof Error) {
    return start_date;
  }
  if (end_date instanceof Error) {
    return end_date;
  }
  if (method instanceof Error) {
    return method;
  }
  var sm = start_date.getMonth();
  var em = end_date.getMonth();
  var sd, ed;
  if (method) {
    sd = start_date.getDate() === 31 ? 30 : start_date.getDate();
    ed = end_date.getDate() === 31 ? 30 : end_date.getDate();
  } else {
    var smd = new Date(start_date.getFullYear(), sm + 1, 0).getDate();
    var emd = new Date(end_date.getFullYear(), em + 1, 0).getDate();
    sd = start_date.getDate() === smd ? 30 : start_date.getDate();
    if (end_date.getDate() === emd) {
      if (sd < 30) {
        em++;
        ed = 1;
      } else {
        ed = 30;
      }
    } else {
      ed = end_date.getDate();
    }
  }
  return 360 * (end_date.getFullYear() - start_date.getFullYear()) + 30 * (em - sm) + (ed - sd);
};
exports.EDATE = function (start_date, months) {
  start_date = utils.parseDate(start_date);
  if (start_date instanceof Error) {
    return start_date;
  }
  if (isNaN(months)) {
    return error.value;
  }
  months = parseInt(months, 10);
  start_date.setMonth(start_date.getMonth() + months);
  return serial(start_date);
};
exports.EOMONTH = function (start_date, months) {
  start_date = utils.parseDate(start_date);
  if (start_date instanceof Error) {
    return start_date;
  }
  if (isNaN(months)) {
    return error.value;
  }
  months = parseInt(months, 10);
  return serial(new Date(start_date.getFullYear(), start_date.getMonth() + months + 1, 0));
};
exports.HOUR = function (serial_number) {
  serial_number = utils.parseDate(serial_number);
  if (serial_number instanceof Error) {
    return serial_number;
  }
  return serial_number.getHours();
};
exports.INTERVAL = function (second) {
  if (typeof second !== 'number' && typeof second !== 'string') {
    return error.value;
  } else {
    second = parseInt(second, 10);
  }
  var year = Math.floor(second / 946080000);
  second = second % 946080000;
  var month = Math.floor(second / 2592000);
  second = second % 2592000;
  var day = Math.floor(second / 86400);
  second = second % 86400;
  var hour = Math.floor(second / 3600);
  second = second % 3600;
  var min = Math.floor(second / 60);
  second = second % 60;
  var sec = second;
  year = year > 0 ? year + 'Y' : '';
  month = month > 0 ? month + 'M' : '';
  day = day > 0 ? day + 'D' : '';
  hour = hour > 0 ? hour + 'H' : '';
  min = min > 0 ? min + 'M' : '';
  sec = sec > 0 ? sec + 'S' : '';
  return 'P' + year + month + day + 'T' + hour + min + sec;
};
exports.ISOWEEKNUM = function (date) {
  date = utils.parseDate(date);
  if (date instanceof Error) {
    return date;
  }
  date.setHours(0, 0, 0);
  date.setDate(date.getDate() + 4 - (date.getDay() || 7));
  var yearStart = new Date(date.getFullYear(), 0, 1);
  return Math.ceil(((date - yearStart) / 86400000 + 1) / 7);
};
exports.MINUTE = function (serial_number) {
  serial_number = utils.parseDate(serial_number);
  if (serial_number instanceof Error) {
    return serial_number;
  }
  return serial_number.getMinutes();
};
exports.MONTH = function (serial_number) {
  serial_number = utils.parseDate(serial_number);
  if (serial_number instanceof Error) {
    return serial_number;
  }
  return serial_number.getMonth() + 1;
};
exports.NETWORKDAYS = function (start_date, end_date, holidays) {
  return this.NETWORKDAYS.INTL(start_date, end_date, 1, holidays);
};
exports.NETWORKDAYS.INTL = function (start_date, end_date, weekend, holidays) {
  start_date = utils.parseDate(start_date);
  if (start_date instanceof Error) {
    return start_date;
  }
  end_date = utils.parseDate(end_date);
  if (end_date instanceof Error) {
    return end_date;
  }
  if (weekend === undefined) {
    weekend = WEEKEND_TYPES[1];
  } else {
    weekend = WEEKEND_TYPES[weekend];
  }
  if (!(weekend instanceof Array)) {
    return error.value;
  }
  if (holidays === undefined) {
    holidays = [];
  } else if (!(holidays instanceof Array)) {
    holidays = [holidays];
  }
  for (var i = 0; i < holidays.length; i++) {
    var h = utils.parseDate(holidays[i]);
    if (h instanceof Error) {
      return h;
    }
    holidays[i] = h;
  }
  var days = (end_date - start_date) / (1000 * 60 * 60 * 24) + 1;
  var total = days;
  var day = start_date;
  for (i = 0; i < days; i++) {
    var d = new Date().getTimezoneOffset() > 0 ? day.getUTCDay() : day.getDay();
    var dec = false;
    if (d === weekend[0] || d === weekend[1]) {
      dec = true;
    }
    for (var j = 0; j < holidays.length; j++) {
      var holiday = holidays[j];
      if (holiday.getDate() === day.getDate() && holiday.getMonth() === day.getMonth() && holiday.getFullYear() === day.getFullYear()) {
        dec = true;
        break;
      }
    }
    if (dec) {
      total--;
    }
    day.setDate(day.getDate() + 1);
  }
  return total;
};
exports.NOW = function () {
  return new Date();
};
exports.SECOND = function (serial_number) {
  serial_number = utils.parseDate(serial_number);
  if (serial_number instanceof Error) {
    return serial_number;
  }
  return serial_number.getSeconds();
};
exports.TIME = function (hour, minute, second) {
  hour = utils.parseNumber(hour);
  minute = utils.parseNumber(minute);
  second = utils.parseNumber(second);
  if (utils.anyIsError(hour, minute, second)) {
    return error.value;
  }
  if (hour < 0 || minute < 0 || second < 0) {
    return error.num;
  }
  return (3600 * hour + 60 * minute + second) / 86400;
};
exports.TIMEVALUE = function (time_text) {
  time_text = utils.parseDate(time_text);
  if (time_text instanceof Error) {
    return time_text;
  }
  return (3600 * time_text.getHours() + 60 * time_text.getMinutes() + time_text.getSeconds()) / 86400;
};
exports.TODAY = function () {
  return new Date();
};
exports.WEEKDAY = function (serial_number, return_type) {
  serial_number = utils.parseDate(serial_number);
  if (serial_number instanceof Error) {
    return serial_number;
  }
  if (return_type === undefined) {
    return_type = 1;
  }
  var day = serial_number.getDay();
  return WEEK_TYPES[return_type][day];
};
exports.WEEKNUM = function (serial_number, return_type) {
  serial_number = utils.parseDate(serial_number);
  if (serial_number instanceof Error) {
    return serial_number;
  }
  if (return_type === undefined) {
    return_type = 1;
  }
  if (return_type === 21) {
    return this.ISOWEEKNUM(serial_number);
  }
  var week_start = WEEK_STARTS[return_type];
  var jan = new Date(serial_number.getFullYear(), 0, 1);
  var inc = jan.getDay() < week_start ? 1 : 0;
  jan -= Math.abs(jan.getDay() - week_start) * 24 * 60 * 60 * 1000;
  return Math.floor((serial_number - jan) / (1000 * 60 * 60 * 24) / 7 + 1) + inc;
};
exports.WORKDAY = function (start_date, days, holidays) {
  return this.WORKDAY.INTL(start_date, days, 1, holidays);
};
exports.WORKDAY.INTL = function (start_date, days, weekend, holidays) {
  start_date = utils.parseDate(start_date);
  if (start_date instanceof Error) {
    return start_date;
  }
  days = utils.parseNumber(days);
  if (days instanceof Error) {
    return days;
  }
  if (days < 0) {
    return error.num;
  }
  if (weekend === undefined) {
    weekend = WEEKEND_TYPES[1];
  } else {
    weekend = WEEKEND_TYPES[weekend];
  }
  if (!(weekend instanceof Array)) {
    return error.value;
  }
  if (holidays === undefined) {
    holidays = [];
  } else if (!(holidays instanceof Array)) {
    holidays = [holidays];
  }
  for (var i = 0; i < holidays.length; i++) {
    var h = utils.parseDate(holidays[i]);
    if (h instanceof Error) {
      return h;
    }
    holidays[i] = h;
  }
  var d = 0;
  while (d < days) {
    start_date.setDate(start_date.getDate() + 1);
    var day = start_date.getDay();
    if (day === weekend[0] || day === weekend[1]) {
      continue;
    }
    for (var j = 0; j < holidays.length; j++) {
      var holiday = holidays[j];
      if (holiday.getDate() === start_date.getDate() && holiday.getMonth() === start_date.getMonth() && holiday.getFullYear() === start_date.getFullYear()) {
        d--;
        break;
      }
    }
    d++;
  }
  return start_date;
};
exports.YEAR = function (serial_number) {
  serial_number = utils.parseDate(serial_number);
  if (serial_number instanceof Error) {
    return serial_number;
  }
  return serial_number.getFullYear();
};
function isLeapYear(year) {
  return new Date(year, 1, 29).getMonth() === 1;
}

// TODO : Use DAYS ?
function daysBetween(start_date, end_date) {
  return Math.ceil((end_date - start_date) / 1000 / 60 / 60 / 24);
}
exports.YEARFRAC = function (start_date, end_date, basis) {
  start_date = utils.parseDate(start_date);
  if (start_date instanceof Error) {
    return start_date;
  }
  end_date = utils.parseDate(end_date);
  if (end_date instanceof Error) {
    return end_date;
  }
  basis = basis || 0;
  var sd = start_date.getDate();
  var sm = start_date.getMonth() + 1;
  var sy = start_date.getFullYear();
  var ed = end_date.getDate();
  var em = end_date.getMonth() + 1;
  var ey = end_date.getFullYear();
  switch (basis) {
    case 0:
      // US (NASD) 30/360
      if (sd === 31 && ed === 31) {
        sd = 30;
        ed = 30;
      } else if (sd === 31) {
        sd = 30;
      } else if (sd === 30 && ed === 31) {
        ed = 30;
      }
      return (ed + em * 30 + ey * 360 - (sd + sm * 30 + sy * 360)) / 360;
    case 1:
      // Actual/actual
      var feb29Between = function (date1, date2) {
        var year1 = date1.getFullYear();
        var mar1year1 = new Date(year1, 2, 1);
        if (isLeapYear(year1) && date1 < mar1year1 && date2 >= mar1year1) {
          return true;
        }
        var year2 = date2.getFullYear();
        var mar1year2 = new Date(year2, 2, 1);
        return isLeapYear(year2) && date2 >= mar1year2 && date1 < mar1year2;
      };
      var ylength = 365;
      if (sy === ey || sy + 1 === ey && (sm > em || sm === em && sd >= ed)) {
        if (sy === ey && isLeapYear(sy) || feb29Between(start_date, end_date) || em === 1 && ed === 29) {
          ylength = 366;
        }
        return daysBetween(start_date, end_date) / ylength;
      }
      var years = ey - sy + 1;
      var days = (new Date(ey + 1, 0, 1) - new Date(sy, 0, 1)) / 1000 / 60 / 60 / 24;
      var average = days / years;
      return daysBetween(start_date, end_date) / average;
    case 2:
      // Actual/360
      return daysBetween(start_date, end_date) / 360;
    case 3:
      // Actual/365
      return daysBetween(start_date, end_date) / 365;
    case 4:
      // European 30/360
      return (ed + em * 30 + ey * 360 - (sd + sm * 30 + sy * 360)) / 360;
  }
};
function serial(date) {
  var addOn = date > -2203891200000 ? 2 : 1;
  return Math.ceil((date - d1900) / 86400000) + addOn;
}

/***/ }),

/***/ 3368:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

var error = __webpack_require__(5734);
var jStat = __webpack_require__(9387);
var text = __webpack_require__(2328);
var utils = __webpack_require__(2593);
var bessel = __webpack_require__(1918);
function isValidBinaryNumber(number) {
  return /^[01]{1,10}$/.test(number);
}
exports.BESSELI = function (x, n) {
  x = utils.parseNumber(x);
  n = utils.parseNumber(n);
  if (utils.anyIsError(x, n)) {
    return error.value;
  }
  return bessel.besseli(x, n);
};
exports.BESSELJ = function (x, n) {
  x = utils.parseNumber(x);
  n = utils.parseNumber(n);
  if (utils.anyIsError(x, n)) {
    return error.value;
  }
  return bessel.besselj(x, n);
};
exports.BESSELK = function (x, n) {
  x = utils.parseNumber(x);
  n = utils.parseNumber(n);
  if (utils.anyIsError(x, n)) {
    return error.value;
  }
  return bessel.besselk(x, n);
};
exports.BESSELY = function (x, n) {
  x = utils.parseNumber(x);
  n = utils.parseNumber(n);
  if (utils.anyIsError(x, n)) {
    return error.value;
  }
  return bessel.bessely(x, n);
};
exports.BIN2DEC = function (number) {
  // Return error if number is not binary or contains more than 10 characters (10 digits)
  if (!isValidBinaryNumber(number)) {
    return error.num;
  }

  // Convert binary number to decimal
  var result = parseInt(number, 2);

  // Handle negative numbers
  var stringified = number.toString();
  if (stringified.length === 10 && stringified.substring(0, 1) === '1') {
    return parseInt(stringified.substring(1), 2) - 512;
  } else {
    return result;
  }
};
exports.BIN2HEX = function (number, places) {
  // Return error if number is not binary or contains more than 10 characters (10 digits)
  if (!isValidBinaryNumber(number)) {
    return error.num;
  }

  // Ignore places and return a 10-character hexadecimal number if number is negative
  var stringified = number.toString();
  if (stringified.length === 10 && stringified.substring(0, 1) === '1') {
    return (1099511627264 + parseInt(stringified.substring(1), 2)).toString(16);
  }

  // Convert binary number to hexadecimal
  var result = parseInt(number, 2).toString(16);

  // Return hexadecimal number using the minimum number of characters necessary if places is undefined
  if (places === undefined) {
    return result;
  } else {
    // Return error if places is nonnumeric
    if (isNaN(places)) {
      return error.value;
    }

    // Return error if places is negative
    if (places < 0) {
      return error.num;
    }

    // Truncate places in case it is not an integer
    places = Math.floor(places);

    // Pad return value with leading 0s (zeros) if necessary (using Underscore.string)
    return places >= result.length ? text.REPT('0', places - result.length) + result : error.num;
  }
};
exports.BIN2OCT = function (number, places) {
  // Return error if number is not binary or contains more than 10 characters (10 digits)
  if (!isValidBinaryNumber(number)) {
    return error.num;
  }

  // Ignore places and return a 10-character octal number if number is negative
  var stringified = number.toString();
  if (stringified.length === 10 && stringified.substring(0, 1) === '1') {
    return (1073741312 + parseInt(stringified.substring(1), 2)).toString(8);
  }

  // Convert binary number to octal
  var result = parseInt(number, 2).toString(8);

  // Return octal number using the minimum number of characters necessary if places is undefined
  if (places === undefined) {
    return result;
  } else {
    // Return error if places is nonnumeric
    if (isNaN(places)) {
      return error.value;
    }

    // Return error if places is negative
    if (places < 0) {
      return error.num;
    }

    // Truncate places in case it is not an integer
    places = Math.floor(places);

    // Pad return value with leading 0s (zeros) if necessary (using Underscore.string)
    return places >= result.length ? text.REPT('0', places - result.length) + result : error.num;
  }
};
exports.BITAND = function (number1, number2) {
  // Return error if either number is a non-numeric value
  number1 = utils.parseNumber(number1);
  number2 = utils.parseNumber(number2);
  if (utils.anyIsError(number1, number2)) {
    return error.value;
  }

  // Return error if either number is less than 0
  if (number1 < 0 || number2 < 0) {
    return error.num;
  }

  // Return error if either number is a non-integer
  if (Math.floor(number1) !== number1 || Math.floor(number2) !== number2) {
    return error.num;
  }

  // Return error if either number is greater than (2^48)-1
  if (number1 > 281474976710655 || number2 > 281474976710655) {
    return error.num;
  }

  // Return bitwise AND of two numbers
  return number1 & number2;
};
exports.BITLSHIFT = function (number, shift) {
  number = utils.parseNumber(number);
  shift = utils.parseNumber(shift);
  if (utils.anyIsError(number, shift)) {
    return error.value;
  }

  // Return error if number is less than 0
  if (number < 0) {
    return error.num;
  }

  // Return error if number is a non-integer
  if (Math.floor(number) !== number) {
    return error.num;
  }

  // Return error if number is greater than (2^48)-1
  if (number > 281474976710655) {
    return error.num;
  }

  // Return error if the absolute value of shift is greater than 53
  if (Math.abs(shift) > 53) {
    return error.num;
  }

  // Return number shifted by shift bits to the left or to the right if shift is negative
  return shift >= 0 ? number << shift : number >> -shift;
};
exports.BITOR = function (number1, number2) {
  number1 = utils.parseNumber(number1);
  number2 = utils.parseNumber(number2);
  if (utils.anyIsError(number1, number2)) {
    return error.value;
  }

  // Return error if either number is less than 0
  if (number1 < 0 || number2 < 0) {
    return error.num;
  }

  // Return error if either number is a non-integer
  if (Math.floor(number1) !== number1 || Math.floor(number2) !== number2) {
    return error.num;
  }

  // Return error if either number is greater than (2^48)-1
  if (number1 > 281474976710655 || number2 > 281474976710655) {
    return error.num;
  }

  // Return bitwise OR of two numbers
  return number1 | number2;
};
exports.BITRSHIFT = function (number, shift) {
  number = utils.parseNumber(number);
  shift = utils.parseNumber(shift);
  if (utils.anyIsError(number, shift)) {
    return error.value;
  }

  // Return error if number is less than 0
  if (number < 0) {
    return error.num;
  }

  // Return error if number is a non-integer
  if (Math.floor(number) !== number) {
    return error.num;
  }

  // Return error if number is greater than (2^48)-1
  if (number > 281474976710655) {
    return error.num;
  }

  // Return error if the absolute value of shift is greater than 53
  if (Math.abs(shift) > 53) {
    return error.num;
  }

  // Return number shifted by shift bits to the right or to the left if shift is negative
  return shift >= 0 ? number >> shift : number << -shift;
};
exports.BITXOR = function (number1, number2) {
  number1 = utils.parseNumber(number1);
  number2 = utils.parseNumber(number2);
  if (utils.anyIsError(number1, number2)) {
    return error.value;
  }

  // Return error if either number is less than 0
  if (number1 < 0 || number2 < 0) {
    return error.num;
  }

  // Return error if either number is a non-integer
  if (Math.floor(number1) !== number1 || Math.floor(number2) !== number2) {
    return error.num;
  }

  // Return error if either number is greater than (2^48)-1
  if (number1 > 281474976710655 || number2 > 281474976710655) {
    return error.num;
  }

  // Return bitwise XOR of two numbers
  return number1 ^ number2;
};
exports.COMPLEX = function (real, imaginary, suffix) {
  real = utils.parseNumber(real);
  imaginary = utils.parseNumber(imaginary);
  if (utils.anyIsError(real, imaginary)) {
    return real;
  }

  // Set suffix
  suffix = suffix === undefined ? 'i' : suffix;

  // Return error if suffix is neither "i" nor "j"
  if (suffix !== 'i' && suffix !== 'j') {
    return error.value;
  }

  // Return complex number
  if (real === 0 && imaginary === 0) {
    return 0;
  } else if (real === 0) {
    return imaginary === 1 ? suffix : imaginary.toString() + suffix;
  } else if (imaginary === 0) {
    return real.toString();
  } else {
    var sign = imaginary > 0 ? '+' : '';
    return real.toString() + sign + (imaginary === 1 ? suffix : imaginary.toString() + suffix);
  }
};
exports.CONVERT = function (number, from_unit, to_unit) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }

  // List of units supported by CONVERT and units defined by the International System of Units
  // [Name, Symbol, Alternate symbols, Quantity, ISU, CONVERT, Conversion ratio]
  var units = [["a.u. of action", "?", null, "action", false, false, 1.05457168181818e-34], ["a.u. of charge", "e", null, "electric_charge", false, false, 1.60217653141414e-19], ["a.u. of energy", "Eh", null, "energy", false, false, 4.35974417757576e-18], ["a.u. of length", "a?", null, "length", false, false, 5.29177210818182e-11], ["a.u. of mass", "m?", null, "mass", false, false, 9.10938261616162e-31], ["a.u. of time", "?/Eh", null, "time", false, false, 2.41888432650516e-17], ["admiralty knot", "admkn", null, "speed", false, true, 0.514773333], ["ampere", "A", null, "electric_current", true, false, 1], ["ampere per meter", "A/m", null, "magnetic_field_intensity", true, false, 1], ["ångström", "Å", ["ang"], "length", false, true, 1e-10], ["are", "ar", null, "area", false, true, 100], ["astronomical unit", "ua", null, "length", false, false, 1.49597870691667e-11], ["bar", "bar", null, "pressure", false, false, 100000], ["barn", "b", null, "area", false, false, 1e-28], ["becquerel", "Bq", null, "radioactivity", true, false, 1], ["bit", "bit", ["b"], "information", false, true, 1], ["btu", "BTU", ["btu"], "energy", false, true, 1055.05585262], ["byte", "byte", null, "information", false, true, 8], ["candela", "cd", null, "luminous_intensity", true, false, 1], ["candela per square metre", "cd/m?", null, "luminance", true, false, 1], ["coulomb", "C", null, "electric_charge", true, false, 1], ["cubic ångström", "ang3", ["ang^3"], "volume", false, true, 1e-30], ["cubic foot", "ft3", ["ft^3"], "volume", false, true, 0.028316846592], ["cubic inch", "in3", ["in^3"], "volume", false, true, 0.000016387064], ["cubic light-year", "ly3", ["ly^3"], "volume", false, true, 8.46786664623715e-47], ["cubic metre", "m?", null, "volume", true, true, 1], ["cubic mile", "mi3", ["mi^3"], "volume", false, true, 4168181825.44058], ["cubic nautical mile", "Nmi3", ["Nmi^3"], "volume", false, true, 6352182208], ["cubic Pica", "Pica3", ["Picapt3", "Pica^3", "Picapt^3"], "volume", false, true, 7.58660370370369e-8], ["cubic yard", "yd3", ["yd^3"], "volume", false, true, 0.764554857984], ["cup", "cup", null, "volume", false, true, 0.0002365882365], ["dalton", "Da", ["u"], "mass", false, false, 1.66053886282828e-27], ["day", "d", ["day"], "time", false, true, 86400], ["degree", "°", null, "angle", false, false, 0.0174532925199433], ["degrees Rankine", "Rank", null, "temperature", false, true, 0.555555555555556], ["dyne", "dyn", ["dy"], "force", false, true, 0.00001], ["electronvolt", "eV", ["ev"], "energy", false, true, 1.60217656514141], ["ell", "ell", null, "length", false, true, 1.143], ["erg", "erg", ["e"], "energy", false, true, 1e-7], ["farad", "F", null, "electric_capacitance", true, false, 1], ["fluid ounce", "oz", null, "volume", false, true, 0.0000295735295625], ["foot", "ft", null, "length", false, true, 0.3048], ["foot-pound", "flb", null, "energy", false, true, 1.3558179483314], ["gal", "Gal", null, "acceleration", false, false, 0.01], ["gallon", "gal", null, "volume", false, true, 0.003785411784], ["gauss", "G", ["ga"], "magnetic_flux_density", false, true, 1], ["grain", "grain", null, "mass", false, true, 0.0000647989], ["gram", "g", null, "mass", false, true, 0.001], ["gray", "Gy", null, "absorbed_dose", true, false, 1], ["gross registered ton", "GRT", ["regton"], "volume", false, true, 2.8316846592], ["hectare", "ha", null, "area", false, true, 10000], ["henry", "H", null, "inductance", true, false, 1], ["hertz", "Hz", null, "frequency", true, false, 1], ["horsepower", "HP", ["h"], "power", false, true, 745.69987158227], ["horsepower-hour", "HPh", ["hh", "hph"], "energy", false, true, 2684519.538], ["hour", "h", ["hr"], "time", false, true, 3600], ["imperial gallon (U.K.)", "uk_gal", null, "volume", false, true, 0.00454609], ["imperial hundredweight", "lcwt", ["uk_cwt", "hweight"], "mass", false, true, 50.802345], ["imperial quart (U.K)", "uk_qt", null, "volume", false, true, 0.0011365225], ["imperial ton", "brton", ["uk_ton", "LTON"], "mass", false, true, 1016.046909], ["inch", "in", null, "length", false, true, 0.0254], ["international acre", "uk_acre", null, "area", false, true, 4046.8564224], ["IT calorie", "cal", null, "energy", false, true, 4.1868], ["joule", "J", null, "energy", true, true, 1], ["katal", "kat", null, "catalytic_activity", true, false, 1], ["kelvin", "K", ["kel"], "temperature", true, true, 1], ["kilogram", "kg", null, "mass", true, true, 1], ["knot", "kn", null, "speed", false, true, 0.514444444444444], ["light-year", "ly", null, "length", false, true, 9460730472580800], ["litre", "L", ["l", "lt"], "volume", false, true, 0.001], ["lumen", "lm", null, "luminous_flux", true, false, 1], ["lux", "lx", null, "illuminance", true, false, 1], ["maxwell", "Mx", null, "magnetic_flux", false, false, 1e-18], ["measurement ton", "MTON", null, "volume", false, true, 1.13267386368], ["meter per hour", "m/h", ["m/hr"], "speed", false, true, 0.00027777777777778], ["meter per second", "m/s", ["m/sec"], "speed", true, true, 1], ["meter per second squared", "m?s??", null, "acceleration", true, false, 1], ["parsec", "pc", ["parsec"], "length", false, true, 30856775814671900], ["meter squared per second", "m?/s", null, "kinematic_viscosity", true, false, 1], ["metre", "m", null, "length", true, true, 1], ["miles per hour", "mph", null, "speed", false, true, 0.44704], ["millimetre of mercury", "mmHg", null, "pressure", false, false, 133.322], ["minute", "?", null, "angle", false, false, 0.000290888208665722], ["minute", "min", ["mn"], "time", false, true, 60], ["modern teaspoon", "tspm", null, "volume", false, true, 0.000005], ["mole", "mol", null, "amount_of_substance", true, false, 1], ["morgen", "Morgen", null, "area", false, true, 2500], ["n.u. of action", "?", null, "action", false, false, 1.05457168181818e-34], ["n.u. of mass", "m?", null, "mass", false, false, 9.10938261616162e-31], ["n.u. of speed", "c?", null, "speed", false, false, 299792458], ["n.u. of time", "?/(me?c??)", null, "time", false, false, 1.28808866778687e-21], ["nautical mile", "M", ["Nmi"], "length", false, true, 1852], ["newton", "N", null, "force", true, true, 1], ["œrsted", "Oe ", null, "magnetic_field_intensity", false, false, 79.5774715459477], ["ohm", "Ω", null, "electric_resistance", true, false, 1], ["ounce mass", "ozm", null, "mass", false, true, 0.028349523125], ["pascal", "Pa", null, "pressure", true, false, 1], ["pascal second", "Pa?s", null, "dynamic_viscosity", true, false, 1], ["pferdestärke", "PS", null, "power", false, true, 735.49875], ["phot", "ph", null, "illuminance", false, false, 0.0001], ["pica (1/6 inch)", "pica", null, "length", false, true, 0.00035277777777778], ["pica (1/72 inch)", "Pica", ["Picapt"], "length", false, true, 0.00423333333333333], ["poise", "P", null, "dynamic_viscosity", false, false, 0.1], ["pond", "pond", null, "force", false, true, 0.00980665], ["pound force", "lbf", null, "force", false, true, 4.4482216152605], ["pound mass", "lbm", null, "mass", false, true, 0.45359237], ["quart", "qt", null, "volume", false, true, 0.000946352946], ["radian", "rad", null, "angle", true, false, 1], ["second", "?", null, "angle", false, false, 0.00000484813681109536], ["second", "s", ["sec"], "time", true, true, 1], ["short hundredweight", "cwt", ["shweight"], "mass", false, true, 45.359237], ["siemens", "S", null, "electrical_conductance", true, false, 1], ["sievert", "Sv", null, "equivalent_dose", true, false, 1], ["slug", "sg", null, "mass", false, true, 14.59390294], ["square ångström", "ang2", ["ang^2"], "area", false, true, 1e-20], ["square foot", "ft2", ["ft^2"], "area", false, true, 0.09290304], ["square inch", "in2", ["in^2"], "area", false, true, 0.00064516], ["square light-year", "ly2", ["ly^2"], "area", false, true, 8.95054210748189e+31], ["square meter", "m?", null, "area", true, true, 1], ["square mile", "mi2", ["mi^2"], "area", false, true, 2589988.110336], ["square nautical mile", "Nmi2", ["Nmi^2"], "area", false, true, 3429904], ["square Pica", "Pica2", ["Picapt2", "Pica^2", "Picapt^2"], "area", false, true, 0.00001792111111111], ["square yard", "yd2", ["yd^2"], "area", false, true, 0.83612736], ["statute mile", "mi", null, "length", false, true, 1609.344], ["steradian", "sr", null, "solid_angle", true, false, 1], ["stilb", "sb", null, "luminance", false, false, 0.0001], ["stokes", "St", null, "kinematic_viscosity", false, false, 0.0001], ["stone", "stone", null, "mass", false, true, 6.35029318], ["tablespoon", "tbs", null, "volume", false, true, 0.0000147868], ["teaspoon", "tsp", null, "volume", false, true, 0.00000492892], ["tesla", "T", null, "magnetic_flux_density", true, true, 1], ["thermodynamic calorie", "c", null, "energy", false, true, 4.184], ["ton", "ton", null, "mass", false, true, 907.18474], ["tonne", "t", null, "mass", false, false, 1000], ["U.K. pint", "uk_pt", null, "volume", false, true, 0.00056826125], ["U.S. bushel", "bushel", null, "volume", false, true, 0.03523907], ["U.S. oil barrel", "barrel", null, "volume", false, true, 0.158987295], ["U.S. pint", "pt", ["us_pt"], "volume", false, true, 0.000473176473], ["U.S. survey mile", "survey_mi", null, "length", false, true, 1609.347219], ["U.S. survey/statute acre", "us_acre", null, "area", false, true, 4046.87261], ["volt", "V", null, "voltage", true, false, 1], ["watt", "W", null, "power", true, true, 1], ["watt-hour", "Wh", ["wh"], "energy", false, true, 3600], ["weber", "Wb", null, "magnetic_flux", true, false, 1], ["yard", "yd", null, "length", false, true, 0.9144], ["year", "yr", null, "time", false, true, 31557600]];

  // Binary prefixes
  // [Name, Prefix power of 2 value, Previx value, Abbreviation, Derived from]
  var binary_prefixes = {
    Yi: ["yobi", 80, 1208925819614629174706176, "Yi", "yotta"],
    Zi: ["zebi", 70, 1180591620717411303424, "Zi", "zetta"],
    Ei: ["exbi", 60, 1152921504606846976, "Ei", "exa"],
    Pi: ["pebi", 50, 1125899906842624, "Pi", "peta"],
    Ti: ["tebi", 40, 1099511627776, "Ti", "tera"],
    Gi: ["gibi", 30, 1073741824, "Gi", "giga"],
    Mi: ["mebi", 20, 1048576, "Mi", "mega"],
    ki: ["kibi", 10, 1024, "ki", "kilo"]
  };

  // Unit prefixes
  // [Name, Multiplier, Abbreviation]
  var unit_prefixes = {
    Y: ["yotta", 1e+24, "Y"],
    Z: ["zetta", 1e+21, "Z"],
    E: ["exa", 1e+18, "E"],
    P: ["peta", 1e+15, "P"],
    T: ["tera", 1e+12, "T"],
    G: ["giga", 1e+09, "G"],
    M: ["mega", 1e+06, "M"],
    k: ["kilo", 1e+03, "k"],
    h: ["hecto", 1e+02, "h"],
    e: ["dekao", 1e+01, "e"],
    d: ["deci", 1e-01, "d"],
    c: ["centi", 1e-02, "c"],
    m: ["milli", 1e-03, "m"],
    u: ["micro", 1e-06, "u"],
    n: ["nano", 1e-09, "n"],
    p: ["pico", 1e-12, "p"],
    f: ["femto", 1e-15, "f"],
    a: ["atto", 1e-18, "a"],
    z: ["zepto", 1e-21, "z"],
    y: ["yocto", 1e-24, "y"]
  };

  // Initialize units and multipliers
  var from = null;
  var to = null;
  var base_from_unit = from_unit;
  var base_to_unit = to_unit;
  var from_multiplier = 1;
  var to_multiplier = 1;
  var alt;

  // Lookup from and to units
  for (var i = 0; i < units.length; i++) {
    alt = units[i][2] === null ? [] : units[i][2];
    if (units[i][1] === base_from_unit || alt.indexOf(base_from_unit) >= 0) {
      from = units[i];
    }
    if (units[i][1] === base_to_unit || alt.indexOf(base_to_unit) >= 0) {
      to = units[i];
    }
  }

  // Lookup from prefix
  if (from === null) {
    var from_binary_prefix = binary_prefixes[from_unit.substring(0, 2)];
    var from_unit_prefix = unit_prefixes[from_unit.substring(0, 1)];

    // Handle dekao unit prefix (only unit prefix with two characters)
    if (from_unit.substring(0, 2) === 'da') {
      from_unit_prefix = ["dekao", 1e+01, "da"];
    }

    // Handle binary prefixes first (so that 'Yi' is processed before 'Y')
    if (from_binary_prefix) {
      from_multiplier = from_binary_prefix[2];
      base_from_unit = from_unit.substring(2);
    } else if (from_unit_prefix) {
      from_multiplier = from_unit_prefix[1];
      base_from_unit = from_unit.substring(from_unit_prefix[2].length);
    }

    // Lookup from unit
    for (var j = 0; j < units.length; j++) {
      alt = units[j][2] === null ? [] : units[j][2];
      if (units[j][1] === base_from_unit || alt.indexOf(base_from_unit) >= 0) {
        from = units[j];
      }
    }
  }

  // Lookup to prefix
  if (to === null) {
    var to_binary_prefix = binary_prefixes[to_unit.substring(0, 2)];
    var to_unit_prefix = unit_prefixes[to_unit.substring(0, 1)];

    // Handle dekao unit prefix (only unit prefix with two characters)
    if (to_unit.substring(0, 2) === 'da') {
      to_unit_prefix = ["dekao", 1e+01, "da"];
    }

    // Handle binary prefixes first (so that 'Yi' is processed before 'Y')
    if (to_binary_prefix) {
      to_multiplier = to_binary_prefix[2];
      base_to_unit = to_unit.substring(2);
    } else if (to_unit_prefix) {
      to_multiplier = to_unit_prefix[1];
      base_to_unit = to_unit.substring(to_unit_prefix[2].length);
    }

    // Lookup to unit
    for (var k = 0; k < units.length; k++) {
      alt = units[k][2] === null ? [] : units[k][2];
      if (units[k][1] === base_to_unit || alt.indexOf(base_to_unit) >= 0) {
        to = units[k];
      }
    }
  }

  // Return error if a unit does not exist
  if (from === null || to === null) {
    return error.na;
  }

  // Return error if units represent different quantities
  if (from[3] !== to[3]) {
    return error.na;
  }

  // Return converted number
  return number * from[6] * from_multiplier / (to[6] * to_multiplier);
};
exports.DEC2BIN = function (number, places) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }

  // Return error if number is not decimal, is lower than -512, or is greater than 511
  if (!/^-?[0-9]{1,3}$/.test(number) || number < -512 || number > 511) {
    return error.num;
  }

  // Ignore places and return a 10-character binary number if number is negative
  if (number < 0) {
    return '1' + text.REPT('0', 9 - (512 + number).toString(2).length) + (512 + number).toString(2);
  }

  // Convert decimal number to binary
  var result = parseInt(number, 10).toString(2);

  // Return binary number using the minimum number of characters necessary if places is undefined
  if (typeof places === 'undefined') {
    return result;
  } else {
    // Return error if places is nonnumeric
    if (isNaN(places)) {
      return error.value;
    }

    // Return error if places is negative
    if (places < 0) {
      return error.num;
    }

    // Truncate places in case it is not an integer
    places = Math.floor(places);

    // Pad return value with leading 0s (zeros) if necessary (using Underscore.string)
    return places >= result.length ? text.REPT('0', places - result.length) + result : error.num;
  }
};
exports.DEC2HEX = function (number, places) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }

  // Return error if number is not decimal, is lower than -549755813888, or is greater than 549755813887
  if (!/^-?[0-9]{1,12}$/.test(number) || number < -549755813888 || number > 549755813887) {
    return error.num;
  }

  // Ignore places and return a 10-character hexadecimal number if number is negative
  if (number < 0) {
    return (1099511627776 + number).toString(16);
  }

  // Convert decimal number to hexadecimal
  var result = parseInt(number, 10).toString(16);

  // Return hexadecimal number using the minimum number of characters necessary if places is undefined
  if (typeof places === 'undefined') {
    return result;
  } else {
    // Return error if places is nonnumeric
    if (isNaN(places)) {
      return error.value;
    }

    // Return error if places is negative
    if (places < 0) {
      return error.num;
    }

    // Truncate places in case it is not an integer
    places = Math.floor(places);

    // Pad return value with leading 0s (zeros) if necessary (using Underscore.string)
    return places >= result.length ? text.REPT('0', places - result.length) + result : error.num;
  }
};
exports.DEC2OCT = function (number, places) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }

  // Return error if number is not decimal, is lower than -549755813888, or is greater than 549755813887
  if (!/^-?[0-9]{1,9}$/.test(number) || number < -536870912 || number > 536870911) {
    return error.num;
  }

  // Ignore places and return a 10-character octal number if number is negative
  if (number < 0) {
    return (1073741824 + number).toString(8);
  }

  // Convert decimal number to octal
  var result = parseInt(number, 10).toString(8);

  // Return octal number using the minimum number of characters necessary if places is undefined
  if (typeof places === 'undefined') {
    return result;
  } else {
    // Return error if places is nonnumeric
    if (isNaN(places)) {
      return error.value;
    }

    // Return error if places is negative
    if (places < 0) {
      return error.num;
    }

    // Truncate places in case it is not an integer
    places = Math.floor(places);

    // Pad return value with leading 0s (zeros) if necessary (using Underscore.string)
    return places >= result.length ? text.REPT('0', places - result.length) + result : error.num;
  }
};
exports.DELTA = function (number1, number2) {
  // Set number2 to zero if undefined
  number2 = number2 === undefined ? 0 : number2;
  number1 = utils.parseNumber(number1);
  number2 = utils.parseNumber(number2);
  if (utils.anyIsError(number1, number2)) {
    return error.value;
  }

  // Return delta
  return number1 === number2 ? 1 : 0;
};

// TODO: why is upper_bound not used ? The excel documentation has no examples with upper_bound
exports.ERF = function (lower_bound, upper_bound) {
  // Set number2 to zero if undefined
  upper_bound = upper_bound === undefined ? 0 : upper_bound;
  lower_bound = utils.parseNumber(lower_bound);
  upper_bound = utils.parseNumber(upper_bound);
  if (utils.anyIsError(lower_bound, upper_bound)) {
    return error.value;
  }
  return jStat.erf(lower_bound);
};

// TODO
exports.ERF.PRECISE = function () {
  throw new Error('ERF.PRECISE is not implemented');
};
exports.ERFC = function (x) {
  // Return error if x is not a number
  if (isNaN(x)) {
    return error.value;
  }
  return jStat.erfc(x);
};

// TODO
exports.ERFC.PRECISE = function () {
  throw new Error('ERFC.PRECISE is not implemented');
};
exports.GESTEP = function (number, step) {
  step = step || 0;
  number = utils.parseNumber(number);
  if (utils.anyIsError(step, number)) {
    return number;
  }

  // Return delta
  return number >= step ? 1 : 0;
};
exports.HEX2BIN = function (number, places) {
  // Return error if number is not hexadecimal or contains more than ten characters (10 digits)
  if (!/^[0-9A-Fa-f]{1,10}$/.test(number)) {
    return error.num;
  }

  // Check if number is negative
  var negative = number.length === 10 && number.substring(0, 1).toLowerCase() === 'f' ? true : false;

  // Convert hexadecimal number to decimal
  var decimal = negative ? parseInt(number, 16) - 1099511627776 : parseInt(number, 16);

  // Return error if number is lower than -512 or greater than 511
  if (decimal < -512 || decimal > 511) {
    return error.num;
  }

  // Ignore places and return a 10-character binary number if number is negative
  if (negative) {
    return '1' + text.REPT('0', 9 - (512 + decimal).toString(2).length) + (512 + decimal).toString(2);
  }

  // Convert decimal number to binary
  var result = decimal.toString(2);

  // Return binary number using the minimum number of characters necessary if places is undefined
  if (places === undefined) {
    return result;
  } else {
    // Return error if places is nonnumeric
    if (isNaN(places)) {
      return error.value;
    }

    // Return error if places is negative
    if (places < 0) {
      return error.num;
    }

    // Truncate places in case it is not an integer
    places = Math.floor(places);

    // Pad return value with leading 0s (zeros) if necessary (using Underscore.string)
    return places >= result.length ? text.REPT('0', places - result.length) + result : error.num;
  }
};
exports.HEX2DEC = function (number) {
  // Return error if number is not hexadecimal or contains more than ten characters (10 digits)
  if (!/^[0-9A-Fa-f]{1,10}$/.test(number)) {
    return error.num;
  }

  // Convert hexadecimal number to decimal
  var decimal = parseInt(number, 16);

  // Return decimal number
  return decimal >= 549755813888 ? decimal - 1099511627776 : decimal;
};
exports.HEX2OCT = function (number, places) {
  // Return error if number is not hexadecimal or contains more than ten characters (10 digits)
  if (!/^[0-9A-Fa-f]{1,10}$/.test(number)) {
    return error.num;
  }

  // Convert hexadecimal number to decimal
  var decimal = parseInt(number, 16);

  // Return error if number is positive and greater than 0x1fffffff (536870911)
  if (decimal > 536870911 && decimal < 1098974756864) {
    return error.num;
  }

  // Ignore places and return a 10-character octal number if number is negative
  if (decimal >= 1098974756864) {
    return (decimal - 1098437885952).toString(8);
  }

  // Convert decimal number to octal
  var result = decimal.toString(8);

  // Return octal number using the minimum number of characters necessary if places is undefined
  if (places === undefined) {
    return result;
  } else {
    // Return error if places is nonnumeric
    if (isNaN(places)) {
      return error.value;
    }

    // Return error if places is negative
    if (places < 0) {
      return error.num;
    }

    // Truncate places in case it is not an integer
    places = Math.floor(places);

    // Pad return value with leading 0s (zeros) if necessary (using Underscore.string)
    return places >= result.length ? text.REPT('0', places - result.length) + result : error.num;
  }
};
exports.IMABS = function (inumber) {
  // Lookup real and imaginary coefficients using exports.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);

  // Return error if either coefficient is not a number
  if (utils.anyIsError(x, y)) {
    return error.value;
  }

  // Return absolute value of complex number
  return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
};
exports.IMAGINARY = function (inumber) {
  if (inumber === undefined || inumber === true || inumber === false) {
    return error.value;
  }

  // Return 0 if inumber is equal to 0
  if (inumber === 0 || inumber === '0') {
    return 0;
  }

  // Handle special cases
  if (['i', 'j'].indexOf(inumber) >= 0) {
    return 1;
  }

  // Normalize imaginary coefficient
  inumber = inumber.replace('+i', '+1i').replace('-i', '-1i').replace('+j', '+1j').replace('-j', '-1j');

  // Lookup sign
  var plus = inumber.indexOf('+');
  var minus = inumber.indexOf('-');
  if (plus === 0) {
    plus = inumber.indexOf('+', 1);
  }
  if (minus === 0) {
    minus = inumber.indexOf('-', 1);
  }

  // Lookup imaginary unit
  var last = inumber.substring(inumber.length - 1, inumber.length);
  var unit = last === 'i' || last === 'j';
  if (plus >= 0 || minus >= 0) {
    // Return error if imaginary unit is neither i nor j
    if (!unit) {
      return error.num;
    }

    // Return imaginary coefficient of complex number
    if (plus >= 0) {
      return isNaN(inumber.substring(0, plus)) || isNaN(inumber.substring(plus + 1, inumber.length - 1)) ? error.num : Number(inumber.substring(plus + 1, inumber.length - 1));
    } else {
      return isNaN(inumber.substring(0, minus)) || isNaN(inumber.substring(minus + 1, inumber.length - 1)) ? error.num : -Number(inumber.substring(minus + 1, inumber.length - 1));
    }
  } else {
    if (unit) {
      return isNaN(inumber.substring(0, inumber.length - 1)) ? error.num : inumber.substring(0, inumber.length - 1);
    } else {
      return isNaN(inumber) ? error.num : 0;
    }
  }
};
exports.IMARGUMENT = function (inumber) {
  // Lookup real and imaginary coefficients using exports.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);

  // Return error if either coefficient is not a number
  if (utils.anyIsError(x, y)) {
    return error.value;
  }

  // Return error if inumber is equal to zero
  if (x === 0 && y === 0) {
    return error.div0;
  }

  // Return PI/2 if x is equal to zero and y is positive
  if (x === 0 && y > 0) {
    return Math.PI / 2;
  }

  // Return -PI/2 if x is equal to zero and y is negative
  if (x === 0 && y < 0) {
    return -Math.PI / 2;
  }

  // Return zero if x is negative and y is equal to zero
  if (y === 0 && x > 0) {
    return 0;
  }

  // Return zero if x is negative and y is equal to zero
  if (y === 0 && x < 0) {
    return -Math.PI;
  }

  // Return argument of complex number
  if (x > 0) {
    return Math.atan(y / x);
  } else if (x < 0 && y >= 0) {
    return Math.atan(y / x) + Math.PI;
  } else {
    return Math.atan(y / x) - Math.PI;
  }
};
exports.IMCONJUGATE = function (inumber) {
  // Lookup real and imaginary coefficients using exports.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);
  if (utils.anyIsError(x, y)) {
    return error.value;
  }

  // Lookup imaginary unit
  var unit = inumber.substring(inumber.length - 1);
  unit = unit === 'i' || unit === 'j' ? unit : 'i';

  // Return conjugate of complex number
  return y !== 0 ? exports.COMPLEX(x, -y, unit) : inumber;
};
exports.IMCOS = function (inumber) {
  // Lookup real and imaginary coefficients using exports.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);
  if (utils.anyIsError(x, y)) {
    return error.value;
  }

  // Lookup imaginary unit
  var unit = inumber.substring(inumber.length - 1);
  unit = unit === 'i' || unit === 'j' ? unit : 'i';

  // Return cosine of complex number
  return exports.COMPLEX(Math.cos(x) * (Math.exp(y) + Math.exp(-y)) / 2, -Math.sin(x) * (Math.exp(y) - Math.exp(-y)) / 2, unit);
};
exports.IMCOSH = function (inumber) {
  // Lookup real and imaginary coefficients using exports.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);
  if (utils.anyIsError(x, y)) {
    return error.value;
  }

  // Lookup imaginary unit
  var unit = inumber.substring(inumber.length - 1);
  unit = unit === 'i' || unit === 'j' ? unit : 'i';

  // Return hyperbolic cosine of complex number
  return exports.COMPLEX(Math.cos(y) * (Math.exp(x) + Math.exp(-x)) / 2, Math.sin(y) * (Math.exp(x) - Math.exp(-x)) / 2, unit);
};
exports.IMCOT = function (inumber) {
  // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);
  if (utils.anyIsError(x, y)) {
    return error.value;
  }

  // Return cotangent of complex number
  return exports.IMDIV(exports.IMCOS(inumber), exports.IMSIN(inumber));
};
exports.IMDIV = function (inumber1, inumber2) {
  // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
  var a = exports.IMREAL(inumber1);
  var b = exports.IMAGINARY(inumber1);
  var c = exports.IMREAL(inumber2);
  var d = exports.IMAGINARY(inumber2);
  if (utils.anyIsError(a, b, c, d)) {
    return error.value;
  }

  // Lookup imaginary unit
  var unit1 = inumber1.substring(inumber1.length - 1);
  var unit2 = inumber2.substring(inumber2.length - 1);
  var unit = 'i';
  if (unit1 === 'j') {
    unit = 'j';
  } else if (unit2 === 'j') {
    unit = 'j';
  }

  // Return error if inumber2 is null
  if (c === 0 && d === 0) {
    return error.num;
  }

  // Return exponential of complex number
  var den = c * c + d * d;
  return exports.COMPLEX((a * c + b * d) / den, (b * c - a * d) / den, unit);
};
exports.IMEXP = function (inumber) {
  // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);
  if (utils.anyIsError(x, y)) {
    return error.value;
  }

  // Lookup imaginary unit
  var unit = inumber.substring(inumber.length - 1);
  unit = unit === 'i' || unit === 'j' ? unit : 'i';

  // Return exponential of complex number
  var e = Math.exp(x);
  return exports.COMPLEX(e * Math.cos(y), e * Math.sin(y), unit);
};
exports.IMLN = function (inumber) {
  // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);
  if (utils.anyIsError(x, y)) {
    return error.value;
  }

  // Lookup imaginary unit
  var unit = inumber.substring(inumber.length - 1);
  unit = unit === 'i' || unit === 'j' ? unit : 'i';

  // Return exponential of complex number
  return exports.COMPLEX(Math.log(Math.sqrt(x * x + y * y)), Math.atan(y / x), unit);
};
exports.IMLOG10 = function (inumber) {
  // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);
  if (utils.anyIsError(x, y)) {
    return error.value;
  }

  // Lookup imaginary unit
  var unit = inumber.substring(inumber.length - 1);
  unit = unit === 'i' || unit === 'j' ? unit : 'i';

  // Return exponential of complex number
  return exports.COMPLEX(Math.log(Math.sqrt(x * x + y * y)) / Math.log(10), Math.atan(y / x) / Math.log(10), unit);
};
exports.IMLOG2 = function (inumber) {
  // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);
  if (utils.anyIsError(x, y)) {
    return error.value;
  }

  // Lookup imaginary unit
  var unit = inumber.substring(inumber.length - 1);
  unit = unit === 'i' || unit === 'j' ? unit : 'i';

  // Return exponential of complex number
  return exports.COMPLEX(Math.log(Math.sqrt(x * x + y * y)) / Math.log(2), Math.atan(y / x) / Math.log(2), unit);
};
exports.IMPOWER = function (inumber, number) {
  number = utils.parseNumber(number);
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);
  if (utils.anyIsError(number, x, y)) {
    return error.value;
  }

  // Lookup imaginary unit
  var unit = inumber.substring(inumber.length - 1);
  unit = unit === 'i' || unit === 'j' ? unit : 'i';

  // Calculate power of modulus
  var p = Math.pow(exports.IMABS(inumber), number);

  // Calculate argument
  var t = exports.IMARGUMENT(inumber);

  // Return exponential of complex number
  return exports.COMPLEX(p * Math.cos(number * t), p * Math.sin(number * t), unit);
};
exports.IMPRODUCT = function () {
  // Initialize result
  var result = arguments[0];
  if (!arguments.length) {
    return error.value;
  }

  // Loop on all numbers
  for (var i = 1; i < arguments.length; i++) {
    // Lookup coefficients of two complex numbers
    var a = exports.IMREAL(result);
    var b = exports.IMAGINARY(result);
    var c = exports.IMREAL(arguments[i]);
    var d = exports.IMAGINARY(arguments[i]);
    if (utils.anyIsError(a, b, c, d)) {
      return error.value;
    }

    // Complute product of two complex numbers
    result = exports.COMPLEX(a * c - b * d, a * d + b * c);
  }

  // Return product of complex numbers
  return result;
};
exports.IMREAL = function (inumber) {
  if (inumber === undefined || inumber === true || inumber === false) {
    return error.value;
  }

  // Return 0 if inumber is equal to 0
  if (inumber === 0 || inumber === '0') {
    return 0;
  }

  // Handle special cases
  if (['i', '+i', '1i', '+1i', '-i', '-1i', 'j', '+j', '1j', '+1j', '-j', '-1j'].indexOf(inumber) >= 0) {
    return 0;
  }

  // Lookup sign
  var plus = inumber.indexOf('+');
  var minus = inumber.indexOf('-');
  if (plus === 0) {
    plus = inumber.indexOf('+', 1);
  }
  if (minus === 0) {
    minus = inumber.indexOf('-', 1);
  }

  // Lookup imaginary unit
  var last = inumber.substring(inumber.length - 1, inumber.length);
  var unit = last === 'i' || last === 'j';
  if (plus >= 0 || minus >= 0) {
    // Return error if imaginary unit is neither i nor j
    if (!unit) {
      return error.num;
    }

    // Return real coefficient of complex number
    if (plus >= 0) {
      return isNaN(inumber.substring(0, plus)) || isNaN(inumber.substring(plus + 1, inumber.length - 1)) ? error.num : Number(inumber.substring(0, plus));
    } else {
      return isNaN(inumber.substring(0, minus)) || isNaN(inumber.substring(minus + 1, inumber.length - 1)) ? error.num : Number(inumber.substring(0, minus));
    }
  } else {
    if (unit) {
      return isNaN(inumber.substring(0, inumber.length - 1)) ? error.num : 0;
    } else {
      return isNaN(inumber) ? error.num : inumber;
    }
  }
};
exports.IMSEC = function (inumber) {
  // Return error if inumber is a logical value
  if (inumber === true || inumber === false) {
    return error.value;
  }

  // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);
  if (utils.anyIsError(x, y)) {
    return error.value;
  }

  // Return secant of complex number
  return exports.IMDIV('1', exports.IMCOS(inumber));
};
exports.IMSECH = function (inumber) {
  // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);
  if (utils.anyIsError(x, y)) {
    return error.value;
  }

  // Return hyperbolic secant of complex number
  return exports.IMDIV('1', exports.IMCOSH(inumber));
};
exports.IMSIN = function (inumber) {
  // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);
  if (utils.anyIsError(x, y)) {
    return error.value;
  }

  // Lookup imaginary unit
  var unit = inumber.substring(inumber.length - 1);
  unit = unit === 'i' || unit === 'j' ? unit : 'i';

  // Return sine of complex number
  return exports.COMPLEX(Math.sin(x) * (Math.exp(y) + Math.exp(-y)) / 2, Math.cos(x) * (Math.exp(y) - Math.exp(-y)) / 2, unit);
};
exports.IMSINH = function (inumber) {
  // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);
  if (utils.anyIsError(x, y)) {
    return error.value;
  }

  // Lookup imaginary unit
  var unit = inumber.substring(inumber.length - 1);
  unit = unit === 'i' || unit === 'j' ? unit : 'i';

  // Return hyperbolic sine of complex number
  return exports.COMPLEX(Math.cos(y) * (Math.exp(x) - Math.exp(-x)) / 2, Math.sin(y) * (Math.exp(x) + Math.exp(-x)) / 2, unit);
};
exports.IMSQRT = function (inumber) {
  // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);
  if (utils.anyIsError(x, y)) {
    return error.value;
  }

  // Lookup imaginary unit
  var unit = inumber.substring(inumber.length - 1);
  unit = unit === 'i' || unit === 'j' ? unit : 'i';

  // Calculate power of modulus
  var s = Math.sqrt(exports.IMABS(inumber));

  // Calculate argument
  var t = exports.IMARGUMENT(inumber);

  // Return exponential of complex number
  return exports.COMPLEX(s * Math.cos(t / 2), s * Math.sin(t / 2), unit);
};
exports.IMCSC = function (inumber) {
  // Return error if inumber is a logical value
  if (inumber === true || inumber === false) {
    return error.value;
  }

  // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);

  // Return error if either coefficient is not a number
  if (utils.anyIsError(x, y)) {
    return error.num;
  }

  // Return cosecant of complex number
  return exports.IMDIV('1', exports.IMSIN(inumber));
};
exports.IMCSCH = function (inumber) {
  // Return error if inumber is a logical value
  if (inumber === true || inumber === false) {
    return error.value;
  }

  // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);

  // Return error if either coefficient is not a number
  if (utils.anyIsError(x, y)) {
    return error.num;
  }

  // Return hyperbolic cosecant of complex number
  return exports.IMDIV('1', exports.IMSINH(inumber));
};
exports.IMSUB = function (inumber1, inumber2) {
  // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
  var a = this.IMREAL(inumber1);
  var b = this.IMAGINARY(inumber1);
  var c = this.IMREAL(inumber2);
  var d = this.IMAGINARY(inumber2);
  if (utils.anyIsError(a, b, c, d)) {
    return error.value;
  }

  // Lookup imaginary unit
  var unit1 = inumber1.substring(inumber1.length - 1);
  var unit2 = inumber2.substring(inumber2.length - 1);
  var unit = 'i';
  if (unit1 === 'j') {
    unit = 'j';
  } else if (unit2 === 'j') {
    unit = 'j';
  }

  // Return _ of two complex numbers
  return this.COMPLEX(a - c, b - d, unit);
};
exports.IMSUM = function () {
  if (!arguments.length) {
    return error.value;
  }
  var args = utils.flatten(arguments);

  // Initialize result
  var result = args[0];

  // Loop on all numbers
  for (var i = 1; i < args.length; i++) {
    // Lookup coefficients of two complex numbers
    var a = this.IMREAL(result);
    var b = this.IMAGINARY(result);
    var c = this.IMREAL(args[i]);
    var d = this.IMAGINARY(args[i]);
    if (utils.anyIsError(a, b, c, d)) {
      return error.value;
    }

    // Complute product of two complex numbers
    result = this.COMPLEX(a + c, b + d);
  }

  // Return sum of complex numbers
  return result;
};
exports.IMTAN = function (inumber) {
  // Return error if inumber is a logical value
  if (inumber === true || inumber === false) {
    return error.value;
  }

  // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
  var x = exports.IMREAL(inumber);
  var y = exports.IMAGINARY(inumber);
  if (utils.anyIsError(x, y)) {
    return error.value;
  }

  // Return tangent of complex number
  return this.IMDIV(this.IMSIN(inumber), this.IMCOS(inumber));
};
exports.OCT2BIN = function (number, places) {
  // Return error if number is not hexadecimal or contains more than ten characters (10 digits)
  if (!/^[0-7]{1,10}$/.test(number)) {
    return error.num;
  }

  // Check if number is negative
  var negative = number.length === 10 && number.substring(0, 1) === '7' ? true : false;

  // Convert octal number to decimal
  var decimal = negative ? parseInt(number, 8) - 1073741824 : parseInt(number, 8);

  // Return error if number is lower than -512 or greater than 511
  if (decimal < -512 || decimal > 511) {
    return error.num;
  }

  // Ignore places and return a 10-character binary number if number is negative
  if (negative) {
    return '1' + text.REPT('0', 9 - (512 + decimal).toString(2).length) + (512 + decimal).toString(2);
  }

  // Convert decimal number to binary
  var result = decimal.toString(2);

  // Return binary number using the minimum number of characters necessary if places is undefined
  if (typeof places === 'undefined') {
    return result;
  } else {
    // Return error if places is nonnumeric
    if (isNaN(places)) {
      return error.value;
    }

    // Return error if places is negative
    if (places < 0) {
      return error.num;
    }

    // Truncate places in case it is not an integer
    places = Math.floor(places);

    // Pad return value with leading 0s (zeros) if necessary (using Underscore.string)
    return places >= result.length ? text.REPT('0', places - result.length) + result : error.num;
  }
};
exports.OCT2DEC = function (number) {
  // Return error if number is not octal or contains more than ten characters (10 digits)
  if (!/^[0-7]{1,10}$/.test(number)) {
    return error.num;
  }

  // Convert octal number to decimal
  var decimal = parseInt(number, 8);

  // Return decimal number
  return decimal >= 536870912 ? decimal - 1073741824 : decimal;
};
exports.OCT2HEX = function (number, places) {
  // Return error if number is not octal or contains more than ten characters (10 digits)
  if (!/^[0-7]{1,10}$/.test(number)) {
    return error.num;
  }

  // Convert octal number to decimal
  var decimal = parseInt(number, 8);

  // Ignore places and return a 10-character octal number if number is negative
  if (decimal >= 536870912) {
    return 'ff' + (decimal + 3221225472).toString(16);
  }

  // Convert decimal number to hexadecimal
  var result = decimal.toString(16);

  // Return hexadecimal number using the minimum number of characters necessary if places is undefined
  if (places === undefined) {
    return result;
  } else {
    // Return error if places is nonnumeric
    if (isNaN(places)) {
      return error.value;
    }

    // Return error if places is negative
    if (places < 0) {
      return error.num;
    }

    // Truncate places in case it is not an integer
    places = Math.floor(places);

    // Pad return value with leading 0s (zeros) if necessary (using Underscore.string)
    return places >= result.length ? text.REPT('0', places - result.length) + result : error.num;
  }
};

/***/ }),

/***/ 4405:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

var error = __webpack_require__(5734);
var dateTime = __webpack_require__(3286);
var utils = __webpack_require__(2593);
function validDate(d) {
  return d && d.getTime && !isNaN(d.getTime());
}
function ensureDate(d) {
  return d instanceof Date ? d : new Date(d);
}
exports.ACCRINT = function (issue, first, settlement, rate, par, frequency, basis) {
  // Return error if either date is invalid
  issue = ensureDate(issue);
  first = ensureDate(first);
  settlement = ensureDate(settlement);
  if (!validDate(issue) || !validDate(first) || !validDate(settlement)) {
    return error.value;
  }

  // Return error if either rate or par are lower than or equal to zero
  if (rate <= 0 || par <= 0) {
    return error.num;
  }

  // Return error if frequency is neither 1, 2, or 4
  if ([1, 2, 4].indexOf(frequency) === -1) {
    return error.num;
  }

  // Return error if basis is neither 0, 1, 2, 3, or 4
  if ([0, 1, 2, 3, 4].indexOf(basis) === -1) {
    return error.num;
  }

  // Return error if settlement is before or equal to issue
  if (settlement <= issue) {
    return error.num;
  }

  // Set default values
  par = par || 0;
  basis = basis || 0;

  // Compute accrued interest
  return par * rate * dateTime.YEARFRAC(issue, settlement, basis);
};

// TODO
exports.ACCRINTM = function () {
  throw new Error('ACCRINTM is not implemented');
};

// TODO
exports.AMORDEGRC = function () {
  throw new Error('AMORDEGRC is not implemented');
};

// TODO
exports.AMORLINC = function () {
  throw new Error('AMORLINC is not implemented');
};

// TODO
exports.COUPDAYBS = function () {
  throw new Error('COUPDAYBS is not implemented');
};

// TODO
exports.COUPDAYS = function () {
  throw new Error('COUPDAYS is not implemented');
};

// TODO
exports.COUPDAYSNC = function () {
  throw new Error('COUPDAYSNC is not implemented');
};

// TODO
exports.COUPNCD = function () {
  throw new Error('COUPNCD is not implemented');
};

// TODO
exports.COUPNUM = function () {
  throw new Error('COUPNUM is not implemented');
};

// TODO
exports.COUPPCD = function () {
  throw new Error('COUPPCD is not implemented');
};
exports.CUMIPMT = function (rate, periods, value, start, end, type) {
  // Credits: algorithm inspired by Apache OpenOffice
  // Credits: Hannes Stiebitzhofer for the translations of function and variable names
  // Requires exports.FV() and exports.PMT() from exports.js [http://stoic.com/exports/]

  rate = utils.parseNumber(rate);
  periods = utils.parseNumber(periods);
  value = utils.parseNumber(value);
  if (utils.anyIsError(rate, periods, value)) {
    return error.value;
  }

  // Return error if either rate, periods, or value are lower than or equal to zero
  if (rate <= 0 || periods <= 0 || value <= 0) {
    return error.num;
  }

  // Return error if start < 1, end < 1, or start > end
  if (start < 1 || end < 1 || start > end) {
    return error.num;
  }

  // Return error if type is neither 0 nor 1
  if (type !== 0 && type !== 1) {
    return error.num;
  }

  // Compute cumulative interest
  var payment = exports.PMT(rate, periods, value, 0, type);
  var interest = 0;
  if (start === 1) {
    if (type === 0) {
      interest = -value;
      start++;
    }
  }
  for (var i = start; i <= end; i++) {
    if (type === 1) {
      interest += exports.FV(rate, i - 2, payment, value, 1) - payment;
    } else {
      interest += exports.FV(rate, i - 1, payment, value, 0);
    }
  }
  interest *= rate;

  // Return cumulative interest
  return interest;
};
exports.CUMPRINC = function (rate, periods, value, start, end, type) {
  // Credits: algorithm inspired by Apache OpenOffice
  // Credits: Hannes Stiebitzhofer for the translations of function and variable names

  rate = utils.parseNumber(rate);
  periods = utils.parseNumber(periods);
  value = utils.parseNumber(value);
  if (utils.anyIsError(rate, periods, value)) {
    return error.value;
  }

  // Return error if either rate, periods, or value are lower than or equal to zero
  if (rate <= 0 || periods <= 0 || value <= 0) {
    return error.num;
  }

  // Return error if start < 1, end < 1, or start > end
  if (start < 1 || end < 1 || start > end) {
    return error.num;
  }

  // Return error if type is neither 0 nor 1
  if (type !== 0 && type !== 1) {
    return error.num;
  }

  // Compute cumulative principal
  var payment = exports.PMT(rate, periods, value, 0, type);
  var principal = 0;
  if (start === 1) {
    if (type === 0) {
      principal = payment + value * rate;
    } else {
      principal = payment;
    }
    start++;
  }
  for (var i = start; i <= end; i++) {
    if (type > 0) {
      principal += payment - (exports.FV(rate, i - 2, payment, value, 1) - payment) * rate;
    } else {
      principal += payment - exports.FV(rate, i - 1, payment, value, 0) * rate;
    }
  }

  // Return cumulative principal
  return principal;
};
exports.DB = function (cost, salvage, life, period, month) {
  // Initialize month
  month = month === undefined ? 12 : month;
  cost = utils.parseNumber(cost);
  salvage = utils.parseNumber(salvage);
  life = utils.parseNumber(life);
  period = utils.parseNumber(period);
  month = utils.parseNumber(month);
  if (utils.anyIsError(cost, salvage, life, period, month)) {
    return error.value;
  }

  // Return error if any of the parameters is negative
  if (cost < 0 || salvage < 0 || life < 0 || period < 0) {
    return error.num;
  }

  // Return error if month is not an integer between 1 and 12
  if ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].indexOf(month) === -1) {
    return error.num;
  }

  // Return error if period is greater than life
  if (period > life) {
    return error.num;
  }

  // Return 0 (zero) if salvage is greater than or equal to cost
  if (salvage >= cost) {
    return 0;
  }

  // Rate is rounded to three decimals places
  var rate = (1 - Math.pow(salvage / cost, 1 / life)).toFixed(3);

  // Compute initial depreciation
  var initial = cost * rate * month / 12;

  // Compute total depreciation
  var total = initial;
  var current = 0;
  var ceiling = period === life ? life - 1 : period;
  for (var i = 2; i <= ceiling; i++) {
    current = (cost - total) * rate;
    total += current;
  }

  // Depreciation for the first and last periods are special cases
  if (period === 1) {
    // First period
    return initial;
  } else if (period === life) {
    // Last period
    return (cost - total) * rate;
  } else {
    return current;
  }
};
exports.DDB = function (cost, salvage, life, period, factor) {
  // Initialize factor
  factor = factor === undefined ? 2 : factor;
  cost = utils.parseNumber(cost);
  salvage = utils.parseNumber(salvage);
  life = utils.parseNumber(life);
  period = utils.parseNumber(period);
  factor = utils.parseNumber(factor);
  if (utils.anyIsError(cost, salvage, life, period, factor)) {
    return error.value;
  }

  // Return error if any of the parameters is negative or if factor is null
  if (cost < 0 || salvage < 0 || life < 0 || period < 0 || factor <= 0) {
    return error.num;
  }

  // Return error if period is greater than life
  if (period > life) {
    return error.num;
  }

  // Return 0 (zero) if salvage is greater than or equal to cost
  if (salvage >= cost) {
    return 0;
  }

  // Compute depreciation
  var total = 0;
  var current = 0;
  for (var i = 1; i <= period; i++) {
    current = Math.min((cost - total) * (factor / life), cost - salvage - total);
    total += current;
  }

  // Return depreciation
  return current;
};

// TODO
exports.DISC = function () {
  throw new Error('DISC is not implemented');
};
exports.DOLLARDE = function (dollar, fraction) {
  // Credits: algorithm inspired by Apache OpenOffice

  dollar = utils.parseNumber(dollar);
  fraction = utils.parseNumber(fraction);
  if (utils.anyIsError(dollar, fraction)) {
    return error.value;
  }

  // Return error if fraction is negative
  if (fraction < 0) {
    return error.num;
  }

  // Return error if fraction is greater than or equal to 0 and less than 1
  if (fraction >= 0 && fraction < 1) {
    return error.div0;
  }

  // Truncate fraction if it is not an integer
  fraction = parseInt(fraction, 10);

  // Compute integer part
  var result = parseInt(dollar, 10);

  // Add decimal part
  result += dollar % 1 * Math.pow(10, Math.ceil(Math.log(fraction) / Math.LN10)) / fraction;

  // Round result
  var power = Math.pow(10, Math.ceil(Math.log(fraction) / Math.LN2) + 1);
  result = Math.round(result * power) / power;

  // Return converted dollar price
  return result;
};
exports.DOLLARFR = function (dollar, fraction) {
  // Credits: algorithm inspired by Apache OpenOffice

  dollar = utils.parseNumber(dollar);
  fraction = utils.parseNumber(fraction);
  if (utils.anyIsError(dollar, fraction)) {
    return error.value;
  }

  // Return error if fraction is negative
  if (fraction < 0) {
    return error.num;
  }

  // Return error if fraction is greater than or equal to 0 and less than 1
  if (fraction >= 0 && fraction < 1) {
    return error.div0;
  }

  // Truncate fraction if it is not an integer
  fraction = parseInt(fraction, 10);

  // Compute integer part
  var result = parseInt(dollar, 10);

  // Add decimal part
  result += dollar % 1 * Math.pow(10, -Math.ceil(Math.log(fraction) / Math.LN10)) * fraction;

  // Return converted dollar price
  return result;
};

// TODO
exports.DURATION = function () {
  throw new Error('DURATION is not implemented');
};
exports.EFFECT = function (rate, periods) {
  rate = utils.parseNumber(rate);
  periods = utils.parseNumber(periods);
  if (utils.anyIsError(rate, periods)) {
    return error.value;
  }

  // Return error if rate <=0 or periods < 1
  if (rate <= 0 || periods < 1) {
    return error.num;
  }

  // Truncate periods if it is not an integer
  periods = parseInt(periods, 10);

  // Return effective annual interest rate
  return Math.pow(1 + rate / periods, periods) - 1;
};
exports.FV = function (rate, periods, payment, value, type) {
  // Credits: algorithm inspired by Apache OpenOffice

  value = value || 0;
  type = type || 0;
  rate = utils.parseNumber(rate);
  periods = utils.parseNumber(periods);
  payment = utils.parseNumber(payment);
  value = utils.parseNumber(value);
  type = utils.parseNumber(type);
  if (utils.anyIsError(rate, periods, payment, value, type)) {
    return error.value;
  }

  // Return future value
  var result;
  if (rate === 0) {
    result = value + payment * periods;
  } else {
    var term = Math.pow(1 + rate, periods);
    if (type === 1) {
      result = value * term + payment * (1 + rate) * (term - 1) / rate;
    } else {
      result = value * term + payment * (term - 1) / rate;
    }
  }
  return -result;
};
exports.FVSCHEDULE = function (principal, schedule) {
  principal = utils.parseNumber(principal);
  schedule = utils.parseNumberArray(utils.flatten(schedule));
  if (utils.anyIsError(principal, schedule)) {
    return error.value;
  }
  var n = schedule.length;
  var future = principal;

  // Apply all interests in schedule
  for (var i = 0; i < n; i++) {
    // Apply scheduled interest
    future *= 1 + schedule[i];
  }

  // Return future value
  return future;
};

// TODO
exports.INTRATE = function () {
  throw new Error('INTRATE is not implemented');
};
exports.IPMT = function (rate, period, periods, present, future, type) {
  // Credits: algorithm inspired by Apache OpenOffice

  future = future || 0;
  type = type || 0;
  rate = utils.parseNumber(rate);
  period = utils.parseNumber(period);
  periods = utils.parseNumber(periods);
  present = utils.parseNumber(present);
  future = utils.parseNumber(future);
  type = utils.parseNumber(type);
  if (utils.anyIsError(rate, period, periods, present, future, type)) {
    return error.value;
  }

  // Compute payment
  var payment = exports.PMT(rate, periods, present, future, type);

  // Compute interest
  var interest;
  if (period === 1) {
    if (type === 1) {
      interest = 0;
    } else {
      interest = -present;
    }
  } else {
    if (type === 1) {
      interest = exports.FV(rate, period - 2, payment, present, 1) - payment;
    } else {
      interest = exports.FV(rate, period - 1, payment, present, 0);
    }
  }

  // Return interest
  return interest * rate;
};
exports.IRR = function (values, guess) {
  // Credits: algorithm inspired by Apache OpenOffice

  guess = guess || 0;
  values = utils.parseNumberArray(utils.flatten(values));
  guess = utils.parseNumber(guess);
  if (utils.anyIsError(values, guess)) {
    return error.value;
  }

  // Calculates the resulting amount
  var irrResult = function (values, dates, rate) {
    var r = rate + 1;
    var result = values[0];
    for (var i = 1; i < values.length; i++) {
      result += values[i] / Math.pow(r, (dates[i] - dates[0]) / 365);
    }
    return result;
  };

  // Calculates the first derivation
  var irrResultDeriv = function (values, dates, rate) {
    var r = rate + 1;
    var result = 0;
    for (var i = 1; i < values.length; i++) {
      var frac = (dates[i] - dates[0]) / 365;
      result -= frac * values[i] / Math.pow(r, frac + 1);
    }
    return result;
  };

  // Initialize dates and check that values contains at least one positive value and one negative value
  var dates = [];
  var positive = false;
  var negative = false;
  for (var i = 0; i < values.length; i++) {
    dates[i] = i === 0 ? 0 : dates[i - 1] + 365;
    if (values[i] > 0) {
      positive = true;
    }
    if (values[i] < 0) {
      negative = true;
    }
  }

  // Return error if values does not contain at least one positive value and one negative value
  if (!positive || !negative) {
    return error.num;
  }

  // Initialize guess and resultRate
  guess = guess === undefined ? 0.1 : guess;
  var resultRate = guess;

  // Set maximum epsilon for end of iteration
  var epsMax = 1e-10;

  // Implement Newton's method
  var newRate, epsRate, resultValue;
  var contLoop = true;
  do {
    resultValue = irrResult(values, dates, resultRate);
    newRate = resultRate - resultValue / irrResultDeriv(values, dates, resultRate);
    epsRate = Math.abs(newRate - resultRate);
    resultRate = newRate;
    contLoop = epsRate > epsMax && Math.abs(resultValue) > epsMax;
  } while (contLoop);

  // Return internal rate of return
  return resultRate;
};
exports.ISPMT = function (rate, period, periods, value) {
  rate = utils.parseNumber(rate);
  period = utils.parseNumber(period);
  periods = utils.parseNumber(periods);
  value = utils.parseNumber(value);
  if (utils.anyIsError(rate, period, periods, value)) {
    return error.value;
  }

  // Return interest
  return value * rate * (period / periods - 1);
};

// TODO
exports.MDURATION = function () {
  throw new Error('MDURATION is not implemented');
};
exports.MIRR = function (values, finance_rate, reinvest_rate) {
  values = utils.parseNumberArray(utils.flatten(values));
  finance_rate = utils.parseNumber(finance_rate);
  reinvest_rate = utils.parseNumber(reinvest_rate);
  if (utils.anyIsError(values, finance_rate, reinvest_rate)) {
    return error.value;
  }

  // Initialize number of values
  var n = values.length;

  // Lookup payments (negative values) and incomes (positive values)
  var payments = [];
  var incomes = [];
  for (var i = 0; i < n; i++) {
    if (values[i] < 0) {
      payments.push(values[i]);
    } else {
      incomes.push(values[i]);
    }
  }

  // Return modified internal rate of return
  var num = -exports.NPV(reinvest_rate, incomes) * Math.pow(1 + reinvest_rate, n - 1);
  var den = exports.NPV(finance_rate, payments) * (1 + finance_rate);
  return Math.pow(num / den, 1 / (n - 1)) - 1;
};
exports.NOMINAL = function (rate, periods) {
  rate = utils.parseNumber(rate);
  periods = utils.parseNumber(periods);
  if (utils.anyIsError(rate, periods)) {
    return error.value;
  }

  // Return error if rate <=0 or periods < 1
  if (rate <= 0 || periods < 1) {
    return error.num;
  }

  // Truncate periods if it is not an integer
  periods = parseInt(periods, 10);

  // Return nominal annual interest rate
  return (Math.pow(rate + 1, 1 / periods) - 1) * periods;
};
exports.NPER = function (rate, payment, present, future, type) {
  type = type === undefined ? 0 : type;
  future = future === undefined ? 0 : future;
  rate = utils.parseNumber(rate);
  payment = utils.parseNumber(payment);
  present = utils.parseNumber(present);
  future = utils.parseNumber(future);
  type = utils.parseNumber(type);
  if (utils.anyIsError(rate, payment, present, future, type)) {
    return error.value;
  }

  // Return number of periods
  var num = payment * (1 + rate * type) - future * rate;
  var den = present * rate + payment * (1 + rate * type);
  return Math.log(num / den) / Math.log(1 + rate);
};
exports.NPV = function () {
  var args = utils.parseNumberArray(utils.flatten(arguments));
  if (args instanceof Error) {
    return args;
  }

  // Lookup rate
  var rate = args[0];

  // Initialize net present value
  var value = 0;

  // Loop on all values
  for (var j = 1; j < args.length; j++) {
    value += args[j] / Math.pow(1 + rate, j);
  }

  // Return net present value
  return value;
};

// TODO
exports.ODDFPRICE = function () {
  throw new Error('ODDFPRICE is not implemented');
};

// TODO
exports.ODDFYIELD = function () {
  throw new Error('ODDFYIELD is not implemented');
};

// TODO
exports.ODDLPRICE = function () {
  throw new Error('ODDLPRICE is not implemented');
};

// TODO
exports.ODDLYIELD = function () {
  throw new Error('ODDLYIELD is not implemented');
};
exports.PDURATION = function (rate, present, future) {
  rate = utils.parseNumber(rate);
  present = utils.parseNumber(present);
  future = utils.parseNumber(future);
  if (utils.anyIsError(rate, present, future)) {
    return error.value;
  }

  // Return error if rate <=0
  if (rate <= 0) {
    return error.num;
  }

  // Return number of periods
  return (Math.log(future) - Math.log(present)) / Math.log(1 + rate);
};
exports.PMT = function (rate, periods, present, future, type) {
  // Credits: algorithm inspired by Apache OpenOffice

  future = future || 0;
  type = type || 0;
  rate = utils.parseNumber(rate);
  periods = utils.parseNumber(periods);
  present = utils.parseNumber(present);
  future = utils.parseNumber(future);
  type = utils.parseNumber(type);
  if (utils.anyIsError(rate, periods, present, future, type)) {
    return error.value;
  }

  // Return payment
  var result;
  if (rate === 0) {
    result = (present + future) / periods;
  } else {
    var term = Math.pow(1 + rate, periods);
    if (type === 1) {
      result = (future * rate / (term - 1) + present * rate / (1 - 1 / term)) / (1 + rate);
    } else {
      result = future * rate / (term - 1) + present * rate / (1 - 1 / term);
    }
  }
  return -result;
};
exports.PPMT = function (rate, period, periods, present, future, type) {
  future = future || 0;
  type = type || 0;
  rate = utils.parseNumber(rate);
  periods = utils.parseNumber(periods);
  present = utils.parseNumber(present);
  future = utils.parseNumber(future);
  type = utils.parseNumber(type);
  if (utils.anyIsError(rate, periods, present, future, type)) {
    return error.value;
  }
  return exports.PMT(rate, periods, present, future, type) - exports.IPMT(rate, period, periods, present, future, type);
};

// TODO
exports.PRICE = function () {
  throw new Error('PRICE is not implemented');
};

// TODO
exports.PRICEDISC = function () {
  throw new Error('PRICEDISC is not implemented');
};

// TODO
exports.PRICEMAT = function () {
  throw new Error('PRICEMAT is not implemented');
};
exports.PV = function (rate, periods, payment, future, type) {
  future = future || 0;
  type = type || 0;
  rate = utils.parseNumber(rate);
  periods = utils.parseNumber(periods);
  payment = utils.parseNumber(payment);
  future = utils.parseNumber(future);
  type = utils.parseNumber(type);
  if (utils.anyIsError(rate, periods, payment, future, type)) {
    return error.value;
  }

  // Return present value
  if (rate === 0) {
    return -payment * periods - future;
  } else {
    return ((1 - Math.pow(1 + rate, periods)) / rate * payment * (1 + rate * type) - future) / Math.pow(1 + rate, periods);
  }
};
exports.RATE = function (periods, payment, present, future, type, guess) {
  // Credits: rabugento

  guess = guess === undefined ? 0.01 : guess;
  future = future === undefined ? 0 : future;
  type = type === undefined ? 0 : type;
  periods = utils.parseNumber(periods);
  payment = utils.parseNumber(payment);
  present = utils.parseNumber(present);
  future = utils.parseNumber(future);
  type = utils.parseNumber(type);
  guess = utils.parseNumber(guess);
  if (utils.anyIsError(periods, payment, present, future, type, guess)) {
    return error.value;
  }

  // Set maximum epsilon for end of iteration
  var epsMax = 1e-10;

  // Set maximum number of iterations
  var iterMax = 50;

  // Implement Newton's method
  var y,
    y0,
    y1,
    x0,
    x1 = 0,
    f = 0,
    i = 0;
  var rate = guess;
  if (Math.abs(rate) < epsMax) {
    y = present * (1 + periods * rate) + payment * (1 + rate * type) * periods + future;
  } else {
    f = Math.exp(periods * Math.log(1 + rate));
    y = present * f + payment * (1 / rate + type) * (f - 1) + future;
  }
  y0 = present + payment * periods + future;
  y1 = present * f + payment * (1 / rate + type) * (f - 1) + future;
  i = x0 = 0;
  x1 = rate;
  while (Math.abs(y0 - y1) > epsMax && i < iterMax) {
    rate = (y1 * x0 - y0 * x1) / (y1 - y0);
    x0 = x1;
    x1 = rate;
    if (Math.abs(rate) < epsMax) {
      y = present * (1 + periods * rate) + payment * (1 + rate * type) * periods + future;
    } else {
      f = Math.exp(periods * Math.log(1 + rate));
      y = present * f + payment * (1 / rate + type) * (f - 1) + future;
    }
    y0 = y1;
    y1 = y;
    ++i;
  }
  return rate;
};

// TODO
exports.RECEIVED = function () {
  throw new Error('RECEIVED is not implemented');
};
exports.RRI = function (periods, present, future) {
  periods = utils.parseNumber(periods);
  present = utils.parseNumber(present);
  future = utils.parseNumber(future);
  if (utils.anyIsError(periods, present, future)) {
    return error.value;
  }

  // Return error if periods or present is equal to 0 (zero)
  if (periods === 0 || present === 0) {
    return error.num;
  }

  // Return equivalent interest rate
  return Math.pow(future / present, 1 / periods) - 1;
};
exports.SLN = function (cost, salvage, life) {
  cost = utils.parseNumber(cost);
  salvage = utils.parseNumber(salvage);
  life = utils.parseNumber(life);
  if (utils.anyIsError(cost, salvage, life)) {
    return error.value;
  }

  // Return error if life equal to 0 (zero)
  if (life === 0) {
    return error.num;
  }

  // Return straight-line depreciation
  return (cost - salvage) / life;
};
exports.SYD = function (cost, salvage, life, period) {
  // Return error if any of the parameters is not a number
  cost = utils.parseNumber(cost);
  salvage = utils.parseNumber(salvage);
  life = utils.parseNumber(life);
  period = utils.parseNumber(period);
  if (utils.anyIsError(cost, salvage, life, period)) {
    return error.value;
  }

  // Return error if life equal to 0 (zero)
  if (life === 0) {
    return error.num;
  }

  // Return error if period is lower than 1 or greater than life
  if (period < 1 || period > life) {
    return error.num;
  }

  // Truncate period if it is not an integer
  period = parseInt(period, 10);

  // Return straight-line depreciation
  return (cost - salvage) * (life - period + 1) * 2 / (life * (life + 1));
};
exports.TBILLEQ = function (settlement, maturity, discount) {
  settlement = utils.parseDate(settlement);
  maturity = utils.parseDate(maturity);
  discount = utils.parseNumber(discount);
  if (utils.anyIsError(settlement, maturity, discount)) {
    return error.value;
  }

  // Return error if discount is lower than or equal to zero
  if (discount <= 0) {
    return error.num;
  }

  // Return error if settlement is greater than maturity
  if (settlement > maturity) {
    return error.num;
  }

  // Return error if maturity is more than one year after settlement
  if (maturity - settlement > 365 * 24 * 60 * 60 * 1000) {
    return error.num;
  }

  // Return bond-equivalent yield
  return 365 * discount / (360 - discount * dateTime.DAYS360(settlement, maturity, false));
};
exports.TBILLPRICE = function (settlement, maturity, discount) {
  settlement = utils.parseDate(settlement);
  maturity = utils.parseDate(maturity);
  discount = utils.parseNumber(discount);
  if (utils.anyIsError(settlement, maturity, discount)) {
    return error.value;
  }

  // Return error if discount is lower than or equal to zero
  if (discount <= 0) {
    return error.num;
  }

  // Return error if settlement is greater than maturity
  if (settlement > maturity) {
    return error.num;
  }

  // Return error if maturity is more than one year after settlement
  if (maturity - settlement > 365 * 24 * 60 * 60 * 1000) {
    return error.num;
  }

  // Return bond-equivalent yield
  return 100 * (1 - discount * dateTime.DAYS360(settlement, maturity, false) / 360);
};
exports.TBILLYIELD = function (settlement, maturity, price) {
  settlement = utils.parseDate(settlement);
  maturity = utils.parseDate(maturity);
  price = utils.parseNumber(price);
  if (utils.anyIsError(settlement, maturity, price)) {
    return error.value;
  }

  // Return error if price is lower than or equal to zero
  if (price <= 0) {
    return error.num;
  }

  // Return error if settlement is greater than maturity
  if (settlement > maturity) {
    return error.num;
  }

  // Return error if maturity is more than one year after settlement
  if (maturity - settlement > 365 * 24 * 60 * 60 * 1000) {
    return error.num;
  }

  // Return bond-equivalent yield
  return (100 - price) * 360 / (price * dateTime.DAYS360(settlement, maturity, false));
};

// TODO
exports.VDB = function () {
  throw new Error('VDB is not implemented');
};

// TODO needs better support for date
// exports.XIRR = function(values, dates, guess) {
//   // Credits: algorithm inspired by Apache OpenOffice
//
//   values = utils.parseNumberArray(utils.flatten(values));
//   dates = utils.parseDateArray(utils.flatten(dates));
//   guess = utils.parseNumber(guess);
//
//   if (utils.anyIsError(values, dates, guess)) {
//     return error.value;
//   }
//
//   // Calculates the resulting amount
//   var irrResult = function(values, dates, rate) {
//     var r = rate + 1;
//     var result = values[0];
//     for (var i = 1; i < values.length; i++) {
//       result += values[i] / Math.pow(r, dateTime.DAYS(dates[i], dates[0]) / 365);
//     }
//     return result;
//   };
//
//   // Calculates the first derivation
//   var irrResultDeriv = function(values, dates, rate) {
//     var r = rate + 1;
//     var result = 0;
//     for (var i = 1; i < values.length; i++) {
//       var frac = dateTime.DAYS(dates[i], dates[0]) / 365;
//       result -= frac * values[i] / Math.pow(r, frac + 1);
//     }
//     return result;
//   };
//
//   // Check that values contains at least one positive value and one negative value
//   var positive = false;
//   var negative = false;
//   for (var i = 0; i < values.length; i++) {
//     if (values[i] > 0) {
//       positive = true;
//     }
//     if (values[i] < 0) {
//       negative = true;
//     }
//   }
//
//   // Return error if values does not contain at least one positive value and one negative value
//   if (!positive || !negative) {
//     return error.num;
//   }
//
//   // Initialize guess and resultRate
//   guess = guess || 0.1;
//   var resultRate = guess;
//
//   // Set maximum epsilon for end of iteration
//   var epsMax = 1e-10;
//
//   // Implement Newton's method
//   var newRate, epsRate, resultValue;
//   var contLoop = true;
//   do {
//     resultValue = irrResult(values, dates, resultRate);
//     newRate = resultRate - resultValue / irrResultDeriv(values, dates, resultRate);
//     epsRate = Math.abs(newRate - resultRate);
//     resultRate = newRate;
//     contLoop = (epsRate > epsMax) && (Math.abs(resultValue) > epsMax);
//   } while (contLoop);
//
//   // Return internal rate of return
//   return resultRate;
// };

exports.XNPV = function (rate, values, dates) {
  rate = utils.parseNumber(rate);
  values = utils.parseNumberArray(utils.flatten(values));
  dates = utils.parseDateArray(utils.flatten(dates));
  if (utils.anyIsError(rate, values, dates)) {
    return error.value;
  }
  var result = 0;
  for (var i = 0; i < values.length; i++) {
    result += values[i] / Math.pow(1 + rate, dateTime.DAYS(dates[i], dates[0]) / 365);
  }
  return result;
};

// TODO
exports.YIELD = function () {
  throw new Error('YIELD is not implemented');
};

// TODO
exports.YIELDDISC = function () {
  throw new Error('YIELDDISC is not implemented');
};

// TODO
exports.YIELDMAT = function () {
  throw new Error('YIELDMAT is not implemented');
};

/***/ }),

/***/ 4589:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

var error = __webpack_require__(5734);

// TODO
exports.CELL = function () {
  throw new Error('CELL is not implemented');
};
exports.ERROR = {};
exports.ERROR.TYPE = function (error_val) {
  switch (error_val) {
    case error.nil:
      return 1;
    case error.div0:
      return 2;
    case error.value:
      return 3;
    case error.ref:
      return 4;
    case error.name:
      return 5;
    case error.num:
      return 6;
    case error.na:
      return 7;
    case error.data:
      return 8;
  }
  return error.na;
};

// TODO
exports.INFO = function () {
  throw new Error('INFO is not implemented');
};
exports.ISBLANK = function (value) {
  return value === null;
};
exports.ISBINARY = function (number) {
  return /^[01]{1,10}$/.test(number);
};
exports.ISERR = function (value) {
  return [error.value, error.ref, error.div0, error.num, error.name, error.nil].indexOf(value) >= 0 || typeof value === 'number' && (isNaN(value) || !isFinite(value));
};
exports.ISERROR = function (value) {
  return exports.ISERR(value) || value === error.na;
};
exports.ISEVEN = function (number) {
  return Math.floor(Math.abs(number)) & 1 ? false : true;
};

// TODO
exports.ISFORMULA = function () {
  throw new Error('ISFORMULA is not implemented');
};
exports.ISLOGICAL = function (value) {
  return value === true || value === false;
};
exports.ISNA = function (value) {
  return value === error.na;
};
exports.ISNONTEXT = function (value) {
  return typeof value !== 'string';
};
exports.ISNUMBER = function (value) {
  return typeof value === 'number' && !isNaN(value) && isFinite(value);
};
exports.ISODD = function (number) {
  return Math.floor(Math.abs(number)) & 1 ? true : false;
};

// TODO
exports.ISREF = function () {
  throw new Error('ISREF is not implemented');
};
exports.ISTEXT = function (value) {
  return typeof value === 'string';
};
exports.N = function (value) {
  if (this.ISNUMBER(value)) {
    return value;
  }
  if (value instanceof Date) {
    return value.getTime();
  }
  if (value === true) {
    return 1;
  }
  if (value === false) {
    return 0;
  }
  if (this.ISERROR(value)) {
    return value;
  }
  return 0;
};
exports.NA = function () {
  return error.na;
};

// TODO
exports.SHEET = function () {
  throw new Error('SHEET is not implemented');
};

// TODO
exports.SHEETS = function () {
  throw new Error('SHEETS is not implemented');
};
exports.TYPE = function (value) {
  if (this.ISNUMBER(value)) {
    return 1;
  }
  if (this.ISTEXT(value)) {
    return 2;
  }
  if (this.ISLOGICAL(value)) {
    return 4;
  }
  if (this.ISERROR(value)) {
    return 16;
  }
  if (Array.isArray(value)) {
    return 64;
  }
};

/***/ }),

/***/ 8737:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

var error = __webpack_require__(5734);
var utils = __webpack_require__(2593);
var information = __webpack_require__(4589);
exports.AND = function () {
  var args = utils.flatten(arguments);
  var result = true;
  for (var i = 0; i < args.length; i++) {
    if (!args[i]) {
      result = false;
    }
  }
  return result;
};
exports.CHOOSE = function () {
  if (arguments.length < 2) {
    return error.na;
  }
  var index = arguments[0];
  if (index < 1 || index > 254) {
    return error.value;
  }
  if (arguments.length < index + 1) {
    return error.value;
  }
  return arguments[index];
};
exports.FALSE = function () {
  return false;
};
exports.IF = function (test, then_value, otherwise_value) {
  return test ? then_value : otherwise_value;
};
exports.IFERROR = function (value, valueIfError) {
  if (information.ISERROR(value)) {
    return valueIfError;
  }
  return value;
};
exports.IFNA = function (value, value_if_na) {
  return value === error.na ? value_if_na : value;
};
exports.NOT = function (logical) {
  return !logical;
};
exports.OR = function () {
  var args = utils.flatten(arguments);
  var result = false;
  for (var i = 0; i < args.length; i++) {
    if (args[i]) {
      result = true;
    }
  }
  return result;
};
exports.TRUE = function () {
  return true;
};
exports.XOR = function () {
  var args = utils.flatten(arguments);
  var result = 0;
  for (var i = 0; i < args.length; i++) {
    if (args[i]) {
      result++;
    }
  }
  return Math.floor(Math.abs(result)) & 1 ? true : false;
};
exports.SWITCH = function () {
  var result;
  if (arguments.length > 0) {
    var targetValue = arguments[0];
    var argc = arguments.length - 1;
    var switchCount = Math.floor(argc / 2);
    var switchSatisfied = false;
    var hasDefaultClause = argc % 2 !== 0;
    var defaultClause = argc % 2 === 0 ? null : arguments[arguments.length - 1];
    if (switchCount) {
      for (var index = 0; index < switchCount; index++) {
        if (targetValue === arguments[index * 2 + 1]) {
          result = arguments[index * 2 + 2];
          switchSatisfied = true;
          break;
        }
      }
    }
    if (!switchSatisfied) {
      result = hasDefaultClause ? defaultClause : error.na;
    }
  } else {
    result = error.value;
  }
  return result;
};

/***/ }),

/***/ 7092:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

var error = __webpack_require__(5734);
var utils = __webpack_require__(2593);
exports.MATCH = function (lookupValue, lookupArray, matchType) {
  if (!lookupValue && !lookupArray) {
    return error.na;
  }
  if (arguments.length === 2) {
    matchType = 1;
  }
  if (!(lookupArray instanceof Array)) {
    return error.na;
  }
  if (matchType !== -1 && matchType !== 0 && matchType !== 1) {
    return error.na;
  }
  var index;
  var indexValue;
  for (var idx = 0; idx < lookupArray.length; idx++) {
    if (matchType === 1) {
      if (lookupArray[idx] === lookupValue) {
        return idx + 1;
      } else if (lookupArray[idx] < lookupValue) {
        if (!indexValue) {
          index = idx + 1;
          indexValue = lookupArray[idx];
        } else if (lookupArray[idx] > indexValue) {
          index = idx + 1;
          indexValue = lookupArray[idx];
        }
      }
    } else if (matchType === 0) {
      if (typeof lookupValue === 'string') {
        lookupValue = lookupValue.replace(/\?/g, '.');
        if (lookupArray[idx].toLowerCase().match(lookupValue.toLowerCase())) {
          return idx + 1;
        }
      } else {
        if (lookupArray[idx] === lookupValue) {
          return idx + 1;
        }
      }
    } else if (matchType === -1) {
      if (lookupArray[idx] === lookupValue) {
        return idx + 1;
      } else if (lookupArray[idx] > lookupValue) {
        if (!indexValue) {
          index = idx + 1;
          indexValue = lookupArray[idx];
        } else if (lookupArray[idx] < indexValue) {
          index = idx + 1;
          indexValue = lookupArray[idx];
        }
      }
    }
  }
  return index ? index : error.na;
};
exports.VLOOKUP = function (needle, table, index, rangeLookup) {
  if (!needle || !table || !index) {
    return error.na;
  }
  rangeLookup = rangeLookup || false;
  for (var i = 0; i < table.length; i++) {
    var row = table[i];
    if (!rangeLookup && row[0] === needle || row[0] === needle || rangeLookup && typeof row[0] === "string" && row[0].toLowerCase().indexOf(needle.toLowerCase()) !== -1) {
      return index < row.length + 1 ? row[index - 1] : error.ref;
    }
  }
  return error.na;
};
exports.HLOOKUP = function (needle, table, index, rangeLookup) {
  if (!needle || !table || !index) {
    return error.na;
  }
  rangeLookup = rangeLookup || false;
  var transposedTable = utils.transpose(table);
  for (var i = 0; i < transposedTable.length; i++) {
    var row = transposedTable[i];
    if (!rangeLookup && row[0] === needle || row[0] === needle || rangeLookup && typeof row[0] === "string" && row[0].toLowerCase().indexOf(needle.toLowerCase()) !== -1) {
      return index < row.length + 1 ? row[index - 1] : error.ref;
    }
  }
  return error.na;
};

/***/ }),

/***/ 2711:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

var utils = __webpack_require__(2593);
var error = __webpack_require__(5734);
var statistical = __webpack_require__(8572);
var information = __webpack_require__(4589);
var evalExpression = __webpack_require__(2933);
exports.ABS = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  var result = Math.abs(number);
  return result;
};
exports.ACOS = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  var result = Math.acos(number);
  if (isNaN(result)) {
    result = error.num;
  }
  return result;
};
exports.ACOSH = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  var result = Math.log(number + Math.sqrt(number * number - 1));
  if (isNaN(result)) {
    result = error.num;
  }
  return result;
};
exports.ACOT = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  var result = Math.atan(1 / number);
  return result;
};
exports.ACOTH = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  var result = 0.5 * Math.log((number + 1) / (number - 1));
  if (isNaN(result)) {
    result = error.num;
  }
  return result;
};

//TODO: use options
exports.AGGREGATE = function (function_num, options, ref1, ref2) {
  function_num = utils.parseNumber(function_num);
  options = utils.parseNumber(function_num);
  if (utils.anyIsError(function_num, options)) {
    return error.value;
  }
  switch (function_num) {
    case 1:
      return statistical.AVERAGE(ref1);
    case 2:
      return statistical.COUNT(ref1);
    case 3:
      return statistical.COUNTA(ref1);
    case 4:
      return statistical.MAX(ref1);
    case 5:
      return statistical.MIN(ref1);
    case 6:
      return exports.PRODUCT(ref1);
    case 7:
      return statistical.STDEV.S(ref1);
    case 8:
      return statistical.STDEV.P(ref1);
    case 9:
      return exports.SUM(ref1);
    case 10:
      return statistical.VAR.S(ref1);
    case 11:
      return statistical.VAR.P(ref1);
    case 12:
      return statistical.MEDIAN(ref1);
    case 13:
      return statistical.MODE.SNGL(ref1);
    case 14:
      return statistical.LARGE(ref1, ref2);
    case 15:
      return statistical.SMALL(ref1, ref2);
    case 16:
      return statistical.PERCENTILE.INC(ref1, ref2);
    case 17:
      return statistical.QUARTILE.INC(ref1, ref2);
    case 18:
      return statistical.PERCENTILE.EXC(ref1, ref2);
    case 19:
      return statistical.QUARTILE.EXC(ref1, ref2);
  }
};
exports.ARABIC = function (text) {
  // Credits: Rafa? Kukawski
  if (!/^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/.test(text)) {
    return error.value;
  }
  var r = 0;
  text.replace(/[MDLV]|C[MD]?|X[CL]?|I[XV]?/g, function (i) {
    r += {
      M: 1000,
      CM: 900,
      D: 500,
      CD: 400,
      C: 100,
      XC: 90,
      L: 50,
      XL: 40,
      X: 10,
      IX: 9,
      V: 5,
      IV: 4,
      I: 1
    }[i];
  });
  return r;
};
exports.ASIN = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  var result = Math.asin(number);
  if (isNaN(result)) {
    result = error.num;
  }
  return result;
};
exports.ASINH = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return Math.log(number + Math.sqrt(number * number + 1));
};
exports.ATAN = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return Math.atan(number);
};
exports.ATAN2 = function (number_x, number_y) {
  number_x = utils.parseNumber(number_x);
  number_y = utils.parseNumber(number_y);
  if (utils.anyIsError(number_x, number_y)) {
    return error.value;
  }
  return Math.atan2(number_x, number_y);
};
exports.ATANH = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  var result = Math.log((1 + number) / (1 - number)) / 2;
  if (isNaN(result)) {
    result = error.num;
  }
  return result;
};
exports.BASE = function (number, radix, min_length) {
  min_length = min_length || 0;
  number = utils.parseNumber(number);
  radix = utils.parseNumber(radix);
  min_length = utils.parseNumber(min_length);
  if (utils.anyIsError(number, radix, min_length)) {
    return error.value;
  }
  min_length = min_length === undefined ? 0 : min_length;
  var result = number.toString(radix);
  return new Array(Math.max(min_length + 1 - result.length, 0)).join('0') + result;
};
exports.CEILING = function (number, significance, mode) {
  significance = significance === undefined ? 1 : Math.abs(significance);
  mode = mode || 0;
  number = utils.parseNumber(number);
  significance = utils.parseNumber(significance);
  mode = utils.parseNumber(mode);
  if (utils.anyIsError(number, significance, mode)) {
    return error.value;
  }
  if (significance === 0) {
    return 0;
  }
  var precision = -Math.floor(Math.log(significance) / Math.log(10));
  if (number >= 0) {
    return exports.ROUND(Math.ceil(number / significance) * significance, precision);
  } else {
    if (mode === 0) {
      return -exports.ROUND(Math.floor(Math.abs(number) / significance) * significance, precision);
    } else {
      return -exports.ROUND(Math.ceil(Math.abs(number) / significance) * significance, precision);
    }
  }
};
exports.CEILING.MATH = exports.CEILING;
exports.CEILING.PRECISE = exports.CEILING;
exports.COMBIN = function (number, number_chosen) {
  number = utils.parseNumber(number);
  number_chosen = utils.parseNumber(number_chosen);
  if (utils.anyIsError(number, number_chosen)) {
    return error.value;
  }
  return exports.FACT(number) / (exports.FACT(number_chosen) * exports.FACT(number - number_chosen));
};
exports.COMBINA = function (number, number_chosen) {
  number = utils.parseNumber(number);
  number_chosen = utils.parseNumber(number_chosen);
  if (utils.anyIsError(number, number_chosen)) {
    return error.value;
  }
  return number === 0 && number_chosen === 0 ? 1 : exports.COMBIN(number + number_chosen - 1, number - 1);
};
exports.COS = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return Math.cos(number);
};
exports.COSH = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return (Math.exp(number) + Math.exp(-number)) / 2;
};
exports.COT = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return 1 / Math.tan(number);
};
exports.COTH = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  var e2 = Math.exp(2 * number);
  return (e2 + 1) / (e2 - 1);
};
exports.CSC = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return 1 / Math.sin(number);
};
exports.CSCH = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return 2 / (Math.exp(number) - Math.exp(-number));
};
exports.DECIMAL = function (number, radix) {
  if (arguments.length < 1) {
    return error.value;
  }
  return parseInt(number, radix);
};
exports.DEGREES = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return number * 180 / Math.PI;
};
exports.EVEN = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return exports.CEILING(number, -2, -1);
};
exports.EXP = function (number) {
  if (arguments.length < 1) {
    return error.na;
  }
  if (typeof number !== 'number' || arguments.length > 1) {
    return error.error;
  }
  number = Math.exp(number);
  return number;
};
var MEMOIZED_FACT = [];
exports.FACT = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  var n = Math.floor(number);
  if (n === 0 || n === 1) {
    return 1;
  } else if (MEMOIZED_FACT[n] > 0) {
    return MEMOIZED_FACT[n];
  } else {
    MEMOIZED_FACT[n] = exports.FACT(n - 1) * n;
    return MEMOIZED_FACT[n];
  }
};
exports.FACTDOUBLE = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  var n = Math.floor(number);
  if (n <= 0) {
    return 1;
  } else {
    return n * exports.FACTDOUBLE(n - 2);
  }
};
exports.FLOOR = function (number, significance) {
  number = utils.parseNumber(number);
  significance = utils.parseNumber(significance);
  if (utils.anyIsError(number, significance)) {
    return error.value;
  }
  if (significance === 0) {
    return 0;
  }
  if (!(number > 0 && significance > 0) && !(number < 0 && significance < 0)) {
    return error.num;
  }
  significance = Math.abs(significance);
  var precision = -Math.floor(Math.log(significance) / Math.log(10));
  if (number >= 0) {
    return exports.ROUND(Math.floor(number / significance) * significance, precision);
  } else {
    return -exports.ROUND(Math.ceil(Math.abs(number) / significance), precision);
  }
};

//TODO: Verify
exports.FLOOR.MATH = function (number, significance, mode) {
  significance = significance === undefined ? 1 : significance;
  mode = mode === undefined ? 0 : mode;
  number = utils.parseNumber(number);
  significance = utils.parseNumber(significance);
  mode = utils.parseNumber(mode);
  if (utils.anyIsError(number, significance, mode)) {
    return error.value;
  }
  if (significance === 0) {
    return 0;
  }
  significance = significance ? Math.abs(significance) : 1;
  var precision = -Math.floor(Math.log(significance) / Math.log(10));
  if (number >= 0) {
    return exports.ROUND(Math.floor(number / significance) * significance, precision);
  } else if (mode === 0 || mode === undefined) {
    return -exports.ROUND(Math.ceil(Math.abs(number) / significance) * significance, precision);
  }
  return -exports.ROUND(Math.floor(Math.abs(number) / significance) * significance, precision);
};

// Deprecated
exports.FLOOR.PRECISE = exports.FLOOR.MATH;

// adapted http://rosettacode.org/wiki/Greatest_common_divisor#JavaScript
exports.GCD = function () {
  var range = utils.parseNumberArray(utils.flatten(arguments));
  if (range instanceof Error) {
    return range;
  }
  var n = range.length;
  var r0 = range[0];
  var x = r0 < 0 ? -r0 : r0;
  for (var i = 1; i < n; i++) {
    var ri = range[i];
    var y = ri < 0 ? -ri : ri;
    while (x && y) {
      if (x > y) {
        x %= y;
      } else {
        y %= x;
      }
    }
    x += y;
  }
  return x;
};
exports.INT = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return Math.floor(number);
};

//TODO: verify
exports.ISO = {
  CEILING: exports.CEILING
};
exports.LCM = function () {
  // Credits: Jonas Raoni Soares Silva
  var o = utils.parseNumberArray(utils.flatten(arguments));
  if (o instanceof Error) {
    return o;
  }
  for (var i, j, n, d, r = 1; (n = o.pop()) !== undefined;) {
    while (n > 1) {
      if (n % 2) {
        for (i = 3, j = Math.floor(Math.sqrt(n)); i <= j && n % i; i += 2) {
          //empty
        }
        d = i <= j ? i : n;
      } else {
        d = 2;
      }
      for (n /= d, r *= d, i = o.length; i; o[--i] % d === 0 && (o[i] /= d) === 1 && o.splice(i, 1)) {
        //empty
      }
    }
  }
  return r;
};
exports.LN = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return Math.log(number);
};
exports.LN10 = function () {
  return Math.log(10);
};
exports.LN2 = function () {
  return Math.log(2);
};
exports.LOG10E = function () {
  return Math.LOG10E;
};
exports.LOG2E = function () {
  return Math.LOG2E;
};
exports.LOG = function (number, base) {
  number = utils.parseNumber(number);
  base = utils.parseNumber(base);
  if (utils.anyIsError(number, base)) {
    return error.value;
  }
  base = base === undefined ? 10 : base;
  return Math.log(number) / Math.log(base);
};
exports.LOG10 = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return Math.log(number) / Math.log(10);
};
exports.MOD = function (dividend, divisor) {
  dividend = utils.parseNumber(dividend);
  divisor = utils.parseNumber(divisor);
  if (utils.anyIsError(dividend, divisor)) {
    return error.value;
  }
  if (divisor === 0) {
    return error.div0;
  }
  var modulus = Math.abs(dividend % divisor);
  return divisor > 0 ? modulus : -modulus;
};
exports.MROUND = function (number, multiple) {
  number = utils.parseNumber(number);
  multiple = utils.parseNumber(multiple);
  if (utils.anyIsError(number, multiple)) {
    return error.value;
  }
  if (number * multiple < 0) {
    return error.num;
  }
  return Math.round(number / multiple) * multiple;
};
exports.MULTINOMIAL = function () {
  var args = utils.parseNumberArray(utils.flatten(arguments));
  if (args instanceof Error) {
    return args;
  }
  var sum = 0;
  var divisor = 1;
  for (var i = 0; i < args.length; i++) {
    sum += args[i];
    divisor *= exports.FACT(args[i]);
  }
  return exports.FACT(sum) / divisor;
};
exports.ODD = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  var temp = Math.ceil(Math.abs(number));
  temp = temp & 1 ? temp : temp + 1;
  return number > 0 ? temp : -temp;
};
exports.PI = function () {
  return Math.PI;
};
exports.E = function () {
  return Math.E;
};
exports.POWER = function (number, power) {
  number = utils.parseNumber(number);
  power = utils.parseNumber(power);
  if (utils.anyIsError(number, power)) {
    return error.value;
  }
  var result = Math.pow(number, power);
  if (isNaN(result)) {
    return error.num;
  }
  return result;
};
exports.PRODUCT = function () {
  var args = utils.parseNumberArray(utils.flatten(arguments));
  if (args instanceof Error) {
    return args;
  }
  var result = 1;
  for (var i = 0; i < args.length; i++) {
    result *= args[i];
  }
  return result;
};
exports.QUOTIENT = function (numerator, denominator) {
  numerator = utils.parseNumber(numerator);
  denominator = utils.parseNumber(denominator);
  if (utils.anyIsError(numerator, denominator)) {
    return error.value;
  }
  return parseInt(numerator / denominator, 10);
};
exports.RADIANS = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return number * Math.PI / 180;
};
exports.RAND = function () {
  return Math.random();
};
exports.RANDBETWEEN = function (bottom, top) {
  bottom = utils.parseNumber(bottom);
  top = utils.parseNumber(top);
  if (utils.anyIsError(bottom, top)) {
    return error.value;
  }
  // Creative Commons Attribution 3.0 License
  // Copyright (c) 2012 eqcode
  return bottom + Math.ceil((top - bottom + 1) * Math.random()) - 1;
};

// TODO
exports.ROMAN = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  // The MIT License
  // Copyright (c) 2008 Steven Levithan
  var digits = String(number).split('');
  var key = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM', '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'];
  var roman = '';
  var i = 3;
  while (i--) {
    roman = (key[+digits.pop() + i * 10] || '') + roman;
  }
  return new Array(+digits.join('') + 1).join('M') + roman;
};
exports.ROUND = function (number, digits) {
  number = utils.parseNumber(number);
  digits = utils.parseNumber(digits);
  if (utils.anyIsError(number, digits)) {
    return error.value;
  }
  return Math.round(number * Math.pow(10, digits)) / Math.pow(10, digits);
};
exports.ROUNDDOWN = function (number, digits) {
  number = utils.parseNumber(number);
  digits = utils.parseNumber(digits);
  if (utils.anyIsError(number, digits)) {
    return error.value;
  }
  var sign = number > 0 ? 1 : -1;
  return sign * Math.floor(Math.abs(number) * Math.pow(10, digits)) / Math.pow(10, digits);
};
exports.ROUNDUP = function (number, digits) {
  number = utils.parseNumber(number);
  digits = utils.parseNumber(digits);
  if (utils.anyIsError(number, digits)) {
    return error.value;
  }
  var sign = number > 0 ? 1 : -1;
  return sign * Math.ceil(Math.abs(number) * Math.pow(10, digits)) / Math.pow(10, digits);
};
exports.SEC = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return 1 / Math.cos(number);
};
exports.SECH = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return 2 / (Math.exp(number) + Math.exp(-number));
};
exports.SERIESSUM = function (x, n, m, coefficients) {
  x = utils.parseNumber(x);
  n = utils.parseNumber(n);
  m = utils.parseNumber(m);
  coefficients = utils.parseNumberArray(coefficients);
  if (utils.anyIsError(x, n, m, coefficients)) {
    return error.value;
  }
  var result = coefficients[0] * Math.pow(x, n);
  for (var i = 1; i < coefficients.length; i++) {
    result += coefficients[i] * Math.pow(x, n + i * m);
  }
  return result;
};
exports.SIGN = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  if (number < 0) {
    return -1;
  } else if (number === 0) {
    return 0;
  } else {
    return 1;
  }
};
exports.SIN = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return Math.sin(number);
};
exports.SINH = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return (Math.exp(number) - Math.exp(-number)) / 2;
};
exports.SQRT = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  if (number < 0) {
    return error.num;
  }
  return Math.sqrt(number);
};
exports.SQRTPI = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return Math.sqrt(number * Math.PI);
};
exports.SQRT1_2 = function () {
  return 1 / Math.sqrt(2);
};
exports.SQRT2 = function () {
  return Math.sqrt(2);
};
exports.SUBTOTAL = function (function_code, ref1) {
  function_code = utils.parseNumber(function_code);
  if (function_code instanceof Error) {
    return function_code;
  }
  switch (function_code) {
    case 1:
      return statistical.AVERAGE(ref1);
    case 2:
      return statistical.COUNT(ref1);
    case 3:
      return statistical.COUNTA(ref1);
    case 4:
      return statistical.MAX(ref1);
    case 5:
      return statistical.MIN(ref1);
    case 6:
      return exports.PRODUCT(ref1);
    case 7:
      return statistical.STDEV.S(ref1);
    case 8:
      return statistical.STDEV.P(ref1);
    case 9:
      return exports.SUM(ref1);
    case 10:
      return statistical.VAR.S(ref1);
    case 11:
      return statistical.VAR.P(ref1);
    // no hidden values for us
    case 101:
      return statistical.AVERAGE(ref1);
    case 102:
      return statistical.COUNT(ref1);
    case 103:
      return statistical.COUNTA(ref1);
    case 104:
      return statistical.MAX(ref1);
    case 105:
      return statistical.MIN(ref1);
    case 106:
      return exports.PRODUCT(ref1);
    case 107:
      return statistical.STDEV.S(ref1);
    case 108:
      return statistical.STDEV.P(ref1);
    case 109:
      return exports.SUM(ref1);
    case 110:
      return statistical.VAR.S(ref1);
    case 111:
      return statistical.VAR.P(ref1);
  }
};
exports.ADD = function (num1, num2) {
  if (arguments.length !== 2) {
    return error.na;
  }
  num1 = utils.parseNumber(num1);
  num2 = utils.parseNumber(num2);
  if (utils.anyIsError(num1, num2)) {
    return error.value;
  }
  return num1 + num2;
};
exports.MINUS = function (num1, num2) {
  if (arguments.length !== 2) {
    return error.na;
  }
  num1 = utils.parseNumber(num1);
  num2 = utils.parseNumber(num2);
  if (utils.anyIsError(num1, num2)) {
    return error.value;
  }
  return num1 - num2;
};
exports.DIVIDE = function (dividend, divisor) {
  if (arguments.length !== 2) {
    return error.na;
  }
  dividend = utils.parseNumber(dividend);
  divisor = utils.parseNumber(divisor);
  if (utils.anyIsError(dividend, divisor)) {
    return error.value;
  }
  if (divisor === 0) {
    return error.div0;
  }
  return dividend / divisor;
};
exports.MULTIPLY = function (factor1, factor2) {
  if (arguments.length !== 2) {
    return error.na;
  }
  factor1 = utils.parseNumber(factor1);
  factor2 = utils.parseNumber(factor2);
  if (utils.anyIsError(factor1, factor2)) {
    return error.value;
  }
  return factor1 * factor2;
};
exports.GTE = function (num1, num2) {
  if (arguments.length !== 2) {
    return error.na;
  }
  num1 = utils.parseNumber(num1);
  num2 = utils.parseNumber(num2);
  if (utils.anyIsError(num1, num2)) {
    return error.error;
  }
  return num1 >= num2;
};
exports.LT = function (num1, num2) {
  if (arguments.length !== 2) {
    return error.na;
  }
  num1 = utils.parseNumber(num1);
  num2 = utils.parseNumber(num2);
  if (utils.anyIsError(num1, num2)) {
    return error.error;
  }
  return num1 < num2;
};
exports.LTE = function (num1, num2) {
  if (arguments.length !== 2) {
    return error.na;
  }
  num1 = utils.parseNumber(num1);
  num2 = utils.parseNumber(num2);
  if (utils.anyIsError(num1, num2)) {
    return error.error;
  }
  return num1 <= num2;
};
exports.EQ = function (value1, value2) {
  if (arguments.length !== 2) {
    return error.na;
  }
  return value1 === value2;
};
exports.NE = function (value1, value2) {
  if (arguments.length !== 2) {
    return error.na;
  }
  return value1 !== value2;
};
exports.POW = function (base, exponent) {
  if (arguments.length !== 2) {
    return error.na;
  }
  base = utils.parseNumber(base);
  exponent = utils.parseNumber(exponent);
  if (utils.anyIsError(base, exponent)) {
    return error.error;
  }
  return exports.POWER(base, exponent);
};
exports.SUM = function () {
  var result = 0;
  utils.arrayEach(utils.argsToArray(arguments), function (value) {
    if (typeof value === 'number') {
      result += value;
    } else if (typeof value === 'string') {
      var parsed = parseFloat(value);
      !isNaN(parsed) && (result += parsed);
    } else if (Array.isArray(value)) {
      result += exports.SUM.apply(null, value);
    }
  });
  return result;
};
exports.SUMIF = function (range, criteria) {
  range = utils.parseNumberArray(utils.flatten(range));
  if (range instanceof Error) {
    return range;
  }
  var result = 0;
  var isWildcard = criteria === void 0 || criteria === '*';
  var tokenizedCriteria = isWildcard ? null : evalExpression.parse(criteria + '');
  for (var i = 0; i < range.length; i++) {
    var value = range[i];
    if (isWildcard) {
      result += value;
    } else {
      var tokens = [evalExpression.createToken(value, evalExpression.TOKEN_TYPE_LITERAL)].concat(tokenizedCriteria);
      result += evalExpression.compute(tokens) ? value : 0;
    }
  }
  return result;
};
exports.SUMIFS = function () {
  var args = utils.argsToArray(arguments);
  var range = utils.parseNumberArray(utils.flatten(args.shift()));
  if (range instanceof Error) {
    return range;
  }
  var criterias = args;
  var n_range_elements = range.length;
  var criteriaLength = criterias.length;
  var result = 0;
  for (var i = 0; i < n_range_elements; i++) {
    var value = range[i];
    var isMeetCondition = false;
    for (var j = 0; j < criteriaLength; j++) {
      var criteria = criterias[j];
      var isWildcard = criteria === void 0 || criteria === '*';
      var computedResult = false;
      if (isWildcard) {
        computedResult = true;
      } else {
        var tokenizedCriteria = evalExpression.parse(criteria + '');
        var tokens = [evalExpression.createToken(value, evalExpression.TOKEN_TYPE_LITERAL)].concat(tokenizedCriteria);
        computedResult = evalExpression.compute(tokens);
      }

      // Criterias are calculated as AND so any `false` breakes the loop as unmeet condition
      if (!computedResult) {
        isMeetCondition = false;
        break;
      }
      isMeetCondition = true;
    }
    if (isMeetCondition) {
      result += value;
    }
  }
  return result;
};
exports.SUMPRODUCT = function () {
  if (!arguments || arguments.length === 0) {
    return error.value;
  }
  var arrays = arguments.length + 1;
  var result = 0;
  var product;
  var k;
  var _i;
  var _ij;
  for (var i = 0; i < arguments[0].length; i++) {
    if (!(arguments[0][i] instanceof Array)) {
      product = 1;
      for (k = 1; k < arrays; k++) {
        _i = utils.parseNumber(arguments[k - 1][i]);
        if (_i instanceof Error) {
          return _i;
        }
        product *= _i;
      }
      result += product;
    } else {
      for (var j = 0; j < arguments[0][i].length; j++) {
        product = 1;
        for (k = 1; k < arrays; k++) {
          _ij = utils.parseNumber(arguments[k - 1][i][j]);
          if (_ij instanceof Error) {
            return _ij;
          }
          product *= _ij;
        }
        result += product;
      }
    }
  }
  return result;
};
exports.SUMSQ = function () {
  var numbers = utils.parseNumberArray(utils.flatten(arguments));
  if (numbers instanceof Error) {
    return numbers;
  }
  var result = 0;
  var length = numbers.length;
  for (var i = 0; i < length; i++) {
    result += information.ISNUMBER(numbers[i]) ? numbers[i] * numbers[i] : 0;
  }
  return result;
};
exports.SUMX2MY2 = function (array_x, array_y) {
  array_x = utils.parseNumberArray(utils.flatten(array_x));
  array_y = utils.parseNumberArray(utils.flatten(array_y));
  if (utils.anyIsError(array_x, array_y)) {
    return error.value;
  }
  var result = 0;
  for (var i = 0; i < array_x.length; i++) {
    result += array_x[i] * array_x[i] - array_y[i] * array_y[i];
  }
  return result;
};
exports.SUMX2PY2 = function (array_x, array_y) {
  array_x = utils.parseNumberArray(utils.flatten(array_x));
  array_y = utils.parseNumberArray(utils.flatten(array_y));
  if (utils.anyIsError(array_x, array_y)) {
    return error.value;
  }
  var result = 0;
  array_x = utils.parseNumberArray(utils.flatten(array_x));
  array_y = utils.parseNumberArray(utils.flatten(array_y));
  for (var i = 0; i < array_x.length; i++) {
    result += array_x[i] * array_x[i] + array_y[i] * array_y[i];
  }
  return result;
};
exports.SUMXMY2 = function (array_x, array_y) {
  array_x = utils.parseNumberArray(utils.flatten(array_x));
  array_y = utils.parseNumberArray(utils.flatten(array_y));
  if (utils.anyIsError(array_x, array_y)) {
    return error.value;
  }
  var result = 0;
  array_x = utils.flatten(array_x);
  array_y = utils.flatten(array_y);
  for (var i = 0; i < array_x.length; i++) {
    result += Math.pow(array_x[i] - array_y[i], 2);
  }
  return result;
};
exports.TAN = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return Math.tan(number);
};
exports.TANH = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  var e2 = Math.exp(2 * number);
  return (e2 - 1) / (e2 + 1);
};
exports.TRUNC = function (number, digits) {
  digits = digits === undefined ? 0 : digits;
  number = utils.parseNumber(number);
  digits = utils.parseNumber(digits);
  if (utils.anyIsError(number, digits)) {
    return error.value;
  }
  var sign = number > 0 ? 1 : -1;
  return sign * Math.floor(Math.abs(number) * Math.pow(10, digits)) / Math.pow(10, digits);
};

/***/ }),

/***/ 8097:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

var utils = __webpack_require__(2593);
var error = __webpack_require__(5734);
exports.UNIQUE = function () {
  var result = [];
  for (var i = 0; i < arguments.length; ++i) {
    var hasElement = false;
    var element = arguments[i];

    // Check if we've already seen this element.
    for (var j = 0; j < result.length; ++j) {
      hasElement = result[j] === element;
      if (hasElement) {
        break;
      }
    }

    // If we did not find it, add it to the result.
    if (!hasElement) {
      result.push(element);
    }
  }
  return result;
};
exports.FLATTEN = utils.flatten;
exports.ARGS2ARRAY = function () {
  return Array.prototype.slice.call(arguments, 0);
};
exports.REFERENCE = function (context, reference) {
  if (!arguments.length) {
    return error.error;
  }
  try {
    var path = reference.split('.');
    var result = context;
    for (var i = 0; i < path.length; ++i) {
      var step = path[i];
      if (step[step.length - 1] === ']') {
        var opening = step.indexOf('[');
        var index = step.substring(opening + 1, step.length - 1);
        result = result[step.substring(0, opening)][index];
      } else {
        result = result[step];
      }
    }
    return result;
  } catch (error) {}
};
exports.JOIN = function (array, separator) {
  return array.join(separator);
};
exports.NUMBERS = function () {
  var possibleNumbers = utils.flatten(arguments);
  return possibleNumbers.filter(function (el) {
    return typeof el === 'number';
  });
};

/***/ }),

/***/ 8572:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

var mathTrig = __webpack_require__(2711);
var text = __webpack_require__(2328);
var jStat = __webpack_require__(9387);
var utils = __webpack_require__(2593);
var evalExpression = __webpack_require__(2933);
var error = __webpack_require__(5734);
var misc = __webpack_require__(8097);
var SQRT2PI = 2.5066282746310002;
exports.AVEDEV = function () {
  var range = utils.parseNumberArray(utils.flatten(arguments));
  if (range instanceof Error) {
    return range;
  }
  return jStat.sum(jStat(range).subtract(jStat.mean(range)).abs()[0]) / range.length;
};
exports.AVERAGE = function () {
  var range = utils.numbers(utils.flatten(arguments));
  var n = range.length;
  var sum = 0;
  var count = 0;
  var result;
  for (var i = 0; i < n; i++) {
    sum += range[i];
    count += 1;
  }
  result = sum / count;
  if (isNaN(result)) {
    result = error.num;
  }
  return result;
};
exports.AVERAGEA = function () {
  var range = utils.flatten(arguments);
  var n = range.length;
  var sum = 0;
  var count = 0;
  var result;
  for (var i = 0; i < n; i++) {
    var el = range[i];
    if (typeof el === 'number') {
      sum += el;
    }
    if (el === true) {
      sum++;
    }
    if (el !== null) {
      count++;
    }
  }
  result = sum / count;
  if (isNaN(result)) {
    result = error.num;
  }
  return result;
};
exports.AVERAGEIF = function (range, criteria, average_range) {
  if (arguments.length <= 1) {
    return error.na;
  }
  average_range = average_range || range;
  range = utils.flatten(range);
  average_range = utils.parseNumberArray(utils.flatten(average_range));
  if (average_range instanceof Error) {
    return average_range;
  }
  var average_count = 0;
  var result = 0;
  var isWildcard = criteria === void 0 || criteria === '*';
  var tokenizedCriteria = isWildcard ? null : evalExpression.parse(criteria + '');
  for (var i = 0; i < range.length; i++) {
    var value = range[i];
    if (isWildcard) {
      result += average_range[i];
      average_count++;
    } else {
      var tokens = [evalExpression.createToken(value, evalExpression.TOKEN_TYPE_LITERAL)].concat(tokenizedCriteria);
      if (evalExpression.compute(tokens)) {
        result += average_range[i];
        average_count++;
      }
    }
  }
  return result / average_count;
};
exports.AVERAGEIFS = function () {
  // Does not work with multi dimensional ranges yet!
  //http://office.microsoft.com/en-001/excel-help/averageifs-function-HA010047493.aspx
  var args = utils.argsToArray(arguments);
  var criteriaLength = (args.length - 1) / 2;
  var range = utils.flatten(args[0]);
  var count = 0;
  var result = 0;
  for (var i = 0; i < range.length; i++) {
    var isMeetCondition = false;
    for (var j = 0; j < criteriaLength; j++) {
      var value = args[2 * j + 1][i];
      var criteria = args[2 * j + 2];
      var isWildcard = criteria === void 0 || criteria === '*';
      var computedResult = false;
      if (isWildcard) {
        computedResult = true;
      } else {
        var tokenizedCriteria = evalExpression.parse(criteria + '');
        var tokens = [evalExpression.createToken(value, evalExpression.TOKEN_TYPE_LITERAL)].concat(tokenizedCriteria);
        computedResult = evalExpression.compute(tokens);
      }

      // Criterias are calculated as AND so any `false` breakes the loop as unmeet condition
      if (!computedResult) {
        isMeetCondition = false;
        break;
      }
      isMeetCondition = true;
    }
    if (isMeetCondition) {
      result += range[i];
      count++;
    }
  }
  var average = result / count;
  if (isNaN(average)) {
    return 0;
  } else {
    return average;
  }
};
exports.BETA = {};
exports.BETA.DIST = function (x, alpha, beta, cumulative, A, B) {
  if (arguments.length < 4) {
    return error.value;
  }
  A = A === undefined ? 0 : A;
  B = B === undefined ? 1 : B;
  x = utils.parseNumber(x);
  alpha = utils.parseNumber(alpha);
  beta = utils.parseNumber(beta);
  A = utils.parseNumber(A);
  B = utils.parseNumber(B);
  if (utils.anyIsError(x, alpha, beta, A, B)) {
    return error.value;
  }
  x = (x - A) / (B - A);
  return cumulative ? jStat.beta.cdf(x, alpha, beta) : jStat.beta.pdf(x, alpha, beta);
};
exports.BETA.INV = function (probability, alpha, beta, A, B) {
  A = A === undefined ? 0 : A;
  B = B === undefined ? 1 : B;
  probability = utils.parseNumber(probability);
  alpha = utils.parseNumber(alpha);
  beta = utils.parseNumber(beta);
  A = utils.parseNumber(A);
  B = utils.parseNumber(B);
  if (utils.anyIsError(probability, alpha, beta, A, B)) {
    return error.value;
  }
  return jStat.beta.inv(probability, alpha, beta) * (B - A) + A;
};
exports.BINOM = {};
exports.BINOM.DIST = function (successes, trials, probability, cumulative) {
  successes = utils.parseNumber(successes);
  trials = utils.parseNumber(trials);
  probability = utils.parseNumber(probability);
  cumulative = utils.parseNumber(cumulative);
  if (utils.anyIsError(successes, trials, probability, cumulative)) {
    return error.value;
  }
  return cumulative ? jStat.binomial.cdf(successes, trials, probability) : jStat.binomial.pdf(successes, trials, probability);
};
exports.BINOM.DIST.RANGE = function (trials, probability, successes, successes2) {
  successes2 = successes2 === undefined ? successes : successes2;
  trials = utils.parseNumber(trials);
  probability = utils.parseNumber(probability);
  successes = utils.parseNumber(successes);
  successes2 = utils.parseNumber(successes2);
  if (utils.anyIsError(trials, probability, successes, successes2)) {
    return error.value;
  }
  var result = 0;
  for (var i = successes; i <= successes2; i++) {
    result += mathTrig.COMBIN(trials, i) * Math.pow(probability, i) * Math.pow(1 - probability, trials - i);
  }
  return result;
};
exports.BINOM.INV = function (trials, probability, alpha) {
  trials = utils.parseNumber(trials);
  probability = utils.parseNumber(probability);
  alpha = utils.parseNumber(alpha);
  if (utils.anyIsError(trials, probability, alpha)) {
    return error.value;
  }
  var x = 0;
  while (x <= trials) {
    if (jStat.binomial.cdf(x, trials, probability) >= alpha) {
      return x;
    }
    x++;
  }
};
exports.CHISQ = {};
exports.CHISQ.DIST = function (x, k, cumulative) {
  x = utils.parseNumber(x);
  k = utils.parseNumber(k);
  if (utils.anyIsError(x, k)) {
    return error.value;
  }
  return cumulative ? jStat.chisquare.cdf(x, k) : jStat.chisquare.pdf(x, k);
};
exports.CHISQ.DIST.RT = function (x, k) {
  if (!x | !k) {
    return error.na;
  }
  if (x < 1 || k > Math.pow(10, 10)) {
    return error.num;
  }
  if (typeof x !== 'number' || typeof k !== 'number') {
    return error.value;
  }
  return 1 - jStat.chisquare.cdf(x, k);
};
exports.CHISQ.INV = function (probability, k) {
  probability = utils.parseNumber(probability);
  k = utils.parseNumber(k);
  if (utils.anyIsError(probability, k)) {
    return error.value;
  }
  return jStat.chisquare.inv(probability, k);
};
exports.CHISQ.INV.RT = function (p, k) {
  if (!p | !k) {
    return error.na;
  }
  if (p < 0 || p > 1 || k < 1 || k > Math.pow(10, 10)) {
    return error.num;
  }
  if (typeof p !== 'number' || typeof k !== 'number') {
    return error.value;
  }
  return jStat.chisquare.inv(1.0 - p, k);
};
exports.CHISQ.TEST = function (observed, expected) {
  if (arguments.length !== 2) {
    return error.na;
  }
  if (!(observed instanceof Array) || !(expected instanceof Array)) {
    return error.value;
  }
  if (observed.length !== expected.length) {
    return error.value;
  }
  if (observed[0] && expected[0] && observed[0].length !== expected[0].length) {
    return error.value;
  }
  var row = observed.length;
  var tmp, i, j;

  // Convert single-dimension array into two-dimension array
  for (i = 0; i < row; i++) {
    if (!(observed[i] instanceof Array)) {
      tmp = observed[i];
      observed[i] = [];
      observed[i].push(tmp);
    }
    if (!(expected[i] instanceof Array)) {
      tmp = expected[i];
      expected[i] = [];
      expected[i].push(tmp);
    }
  }
  var col = observed[0].length;
  var dof = col === 1 ? row - 1 : (row - 1) * (col - 1);
  var xsqr = 0;
  var Pi = Math.PI;
  for (i = 0; i < row; i++) {
    for (j = 0; j < col; j++) {
      xsqr += Math.pow(observed[i][j] - expected[i][j], 2) / expected[i][j];
    }
  }

  // Get independency by X square and its degree of freedom
  function ChiSq(xsqr, dof) {
    var p = Math.exp(-0.5 * xsqr);
    if (dof % 2 === 1) {
      p = p * Math.sqrt(2 * xsqr / Pi);
    }
    var k = dof;
    while (k >= 2) {
      p = p * xsqr / k;
      k = k - 2;
    }
    var t = p;
    var a = dof;
    while (t > 0.0000000001 * p) {
      a = a + 2;
      t = t * xsqr / a;
      p = p + t;
    }
    return 1 - p;
  }
  return Math.round(ChiSq(xsqr, dof) * 1000000) / 1000000;
};
exports.COLUMN = function (matrix, index) {
  if (arguments.length !== 2) {
    return error.na;
  }
  if (index < 0) {
    return error.num;
  }
  if (!(matrix instanceof Array) || typeof index !== 'number') {
    return error.value;
  }
  if (matrix.length === 0) {
    return undefined;
  }
  return jStat.col(matrix, index);
};
exports.COLUMNS = function (matrix) {
  if (arguments.length !== 1) {
    return error.na;
  }
  if (!(matrix instanceof Array)) {
    return error.value;
  }
  if (matrix.length === 0) {
    return 0;
  }
  return jStat.cols(matrix);
};
exports.CONFIDENCE = {};
exports.CONFIDENCE.NORM = function (alpha, sd, n) {
  alpha = utils.parseNumber(alpha);
  sd = utils.parseNumber(sd);
  n = utils.parseNumber(n);
  if (utils.anyIsError(alpha, sd, n)) {
    return error.value;
  }
  return jStat.normalci(1, alpha, sd, n)[1] - 1;
};
exports.CONFIDENCE.T = function (alpha, sd, n) {
  alpha = utils.parseNumber(alpha);
  sd = utils.parseNumber(sd);
  n = utils.parseNumber(n);
  if (utils.anyIsError(alpha, sd, n)) {
    return error.value;
  }
  return jStat.tci(1, alpha, sd, n)[1] - 1;
};
exports.CORREL = function (array1, array2) {
  array1 = utils.parseNumberArray(utils.flatten(array1));
  array2 = utils.parseNumberArray(utils.flatten(array2));
  if (utils.anyIsError(array1, array2)) {
    return error.value;
  }
  return jStat.corrcoeff(array1, array2);
};
exports.COUNT = function () {
  return utils.numbers(utils.flatten(arguments)).length;
};
exports.COUNTA = function () {
  var range = utils.flatten(arguments);
  return range.length - exports.COUNTBLANK(range);
};
exports.COUNTIN = function (range, value) {
  var result = 0;
  range = utils.flatten(range);
  for (var i = 0; i < range.length; i++) {
    if (range[i] === value) {
      result++;
    }
  }
  return result;
};
exports.COUNTBLANK = function () {
  var range = utils.flatten(arguments);
  var blanks = 0;
  var element;
  for (var i = 0; i < range.length; i++) {
    element = range[i];
    if (element === null || element === '') {
      blanks++;
    }
  }
  return blanks;
};
exports.COUNTIF = function (range, criteria) {
  range = utils.flatten(range);
  var isWildcard = criteria === void 0 || criteria === '*';
  if (isWildcard) {
    return range.length;
  }
  var matches = 0;
  var tokenizedCriteria = evalExpression.parse(criteria + '');
  for (var i = 0; i < range.length; i++) {
    var value = range[i];
    var tokens = [evalExpression.createToken(value, evalExpression.TOKEN_TYPE_LITERAL)].concat(tokenizedCriteria);
    if (evalExpression.compute(tokens)) {
      matches++;
    }
  }
  return matches;
};
exports.COUNTIFS = function () {
  var args = utils.argsToArray(arguments);
  var results = new Array(utils.flatten(args[0]).length);
  for (var i = 0; i < results.length; i++) {
    results[i] = true;
  }
  for (i = 0; i < args.length; i += 2) {
    var range = utils.flatten(args[i]);
    var criteria = args[i + 1];
    var isWildcard = criteria === void 0 || criteria === '*';
    if (!isWildcard) {
      var tokenizedCriteria = evalExpression.parse(criteria + '');
      for (var j = 0; j < range.length; j++) {
        var value = range[j];
        var tokens = [evalExpression.createToken(value, evalExpression.TOKEN_TYPE_LITERAL)].concat(tokenizedCriteria);
        results[j] = results[j] && evalExpression.compute(tokens);
      }
    }
  }
  var result = 0;
  for (i = 0; i < results.length; i++) {
    if (results[i]) {
      result++;
    }
  }
  return result;
};
exports.COUNTUNIQUE = function () {
  return misc.UNIQUE.apply(null, utils.flatten(arguments)).length;
};
exports.COVARIANCE = {};
exports.COVARIANCE.P = function (array1, array2) {
  array1 = utils.parseNumberArray(utils.flatten(array1));
  array2 = utils.parseNumberArray(utils.flatten(array2));
  if (utils.anyIsError(array1, array2)) {
    return error.value;
  }
  var mean1 = jStat.mean(array1);
  var mean2 = jStat.mean(array2);
  var result = 0;
  var n = array1.length;
  for (var i = 0; i < n; i++) {
    result += (array1[i] - mean1) * (array2[i] - mean2);
  }
  return result / n;
};
exports.COVARIANCE.S = function (array1, array2) {
  array1 = utils.parseNumberArray(utils.flatten(array1));
  array2 = utils.parseNumberArray(utils.flatten(array2));
  if (utils.anyIsError(array1, array2)) {
    return error.value;
  }
  return jStat.covariance(array1, array2);
};
exports.DEVSQ = function () {
  var range = utils.parseNumberArray(utils.flatten(arguments));
  if (range instanceof Error) {
    return range;
  }
  var mean = jStat.mean(range);
  var result = 0;
  for (var i = 0; i < range.length; i++) {
    result += Math.pow(range[i] - mean, 2);
  }
  return result;
};
exports.EXPON = {};
exports.EXPON.DIST = function (x, lambda, cumulative) {
  x = utils.parseNumber(x);
  lambda = utils.parseNumber(lambda);
  if (utils.anyIsError(x, lambda)) {
    return error.value;
  }
  return cumulative ? jStat.exponential.cdf(x, lambda) : jStat.exponential.pdf(x, lambda);
};
exports.F = {};
exports.F.DIST = function (x, d1, d2, cumulative) {
  x = utils.parseNumber(x);
  d1 = utils.parseNumber(d1);
  d2 = utils.parseNumber(d2);
  if (utils.anyIsError(x, d1, d2)) {
    return error.value;
  }
  return cumulative ? jStat.centralF.cdf(x, d1, d2) : jStat.centralF.pdf(x, d1, d2);
};
exports.F.DIST.RT = function (x, d1, d2) {
  if (arguments.length !== 3) {
    return error.na;
  }
  if (x < 0 || d1 < 1 || d2 < 1) {
    return error.num;
  }
  if (typeof x !== 'number' || typeof d1 !== 'number' || typeof d2 !== 'number') {
    return error.value;
  }
  return 1 - jStat.centralF.cdf(x, d1, d2);
};
exports.F.INV = function (probability, d1, d2) {
  probability = utils.parseNumber(probability);
  d1 = utils.parseNumber(d1);
  d2 = utils.parseNumber(d2);
  if (utils.anyIsError(probability, d1, d2)) {
    return error.value;
  }
  if (probability <= 0.0 || probability > 1.0) {
    return error.num;
  }
  return jStat.centralF.inv(probability, d1, d2);
};
exports.F.INV.RT = function (p, d1, d2) {
  if (arguments.length !== 3) {
    return error.na;
  }
  if (p < 0 || p > 1 || d1 < 1 || d1 > Math.pow(10, 10) || d2 < 1 || d2 > Math.pow(10, 10)) {
    return error.num;
  }
  if (typeof p !== 'number' || typeof d1 !== 'number' || typeof d2 !== 'number') {
    return error.value;
  }
  return jStat.centralF.inv(1.0 - p, d1, d2);
};
exports.F.TEST = function (array1, array2) {
  if (!array1 || !array2) {
    return error.na;
  }
  if (!(array1 instanceof Array) || !(array2 instanceof Array)) {
    return error.na;
  }
  if (array1.length < 2 || array2.length < 2) {
    return error.div0;
  }
  var sumOfSquares = function (values, x1) {
    var sum = 0;
    for (var i = 0; i < values.length; i++) {
      sum += Math.pow(values[i] - x1, 2);
    }
    return sum;
  };
  var x1 = mathTrig.SUM(array1) / array1.length;
  var x2 = mathTrig.SUM(array2) / array2.length;
  var sum1 = sumOfSquares(array1, x1) / (array1.length - 1);
  var sum2 = sumOfSquares(array2, x2) / (array2.length - 1);
  return sum1 / sum2;
};
exports.FISHER = function (x) {
  x = utils.parseNumber(x);
  if (x instanceof Error) {
    return x;
  }
  return Math.log((1 + x) / (1 - x)) / 2;
};
exports.FISHERINV = function (y) {
  y = utils.parseNumber(y);
  if (y instanceof Error) {
    return y;
  }
  var e2y = Math.exp(2 * y);
  return (e2y - 1) / (e2y + 1);
};
exports.FORECAST = function (x, data_y, data_x) {
  x = utils.parseNumber(x);
  data_y = utils.parseNumberArray(utils.flatten(data_y));
  data_x = utils.parseNumberArray(utils.flatten(data_x));
  if (utils.anyIsError(x, data_y, data_x)) {
    return error.value;
  }
  var xmean = jStat.mean(data_x);
  var ymean = jStat.mean(data_y);
  var n = data_x.length;
  var num = 0;
  var den = 0;
  for (var i = 0; i < n; i++) {
    num += (data_x[i] - xmean) * (data_y[i] - ymean);
    den += Math.pow(data_x[i] - xmean, 2);
  }
  var b = num / den;
  var a = ymean - b * xmean;
  return a + b * x;
};
exports.FREQUENCY = function (data, bins) {
  data = utils.parseNumberArray(utils.flatten(data));
  bins = utils.parseNumberArray(utils.flatten(bins));
  if (utils.anyIsError(data, bins)) {
    return error.value;
  }
  var n = data.length;
  var b = bins.length;
  var r = [];
  for (var i = 0; i <= b; i++) {
    r[i] = 0;
    for (var j = 0; j < n; j++) {
      if (i === 0) {
        if (data[j] <= bins[0]) {
          r[0] += 1;
        }
      } else if (i < b) {
        if (data[j] > bins[i - 1] && data[j] <= bins[i]) {
          r[i] += 1;
        }
      } else if (i === b) {
        if (data[j] > bins[b - 1]) {
          r[b] += 1;
        }
      }
    }
  }
  return r;
};
exports.GAMMA = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  if (number === 0) {
    return error.num;
  }
  if (parseInt(number, 10) === number && number < 0) {
    return error.num;
  }
  return jStat.gammafn(number);
};
exports.GAMMA.DIST = function (value, alpha, beta, cumulative) {
  if (arguments.length !== 4) {
    return error.na;
  }
  if (value < 0 || alpha <= 0 || beta <= 0) {
    return error.value;
  }
  if (typeof value !== 'number' || typeof alpha !== 'number' || typeof beta !== 'number') {
    return error.value;
  }
  return cumulative ? jStat.gamma.cdf(value, alpha, beta, true) : jStat.gamma.pdf(value, alpha, beta, false);
};
exports.GAMMA.INV = function (probability, alpha, beta) {
  if (arguments.length !== 3) {
    return error.na;
  }
  if (probability < 0 || probability > 1 || alpha <= 0 || beta <= 0) {
    return error.num;
  }
  if (typeof probability !== 'number' || typeof alpha !== 'number' || typeof beta !== 'number') {
    return error.value;
  }
  return jStat.gamma.inv(probability, alpha, beta);
};
exports.GAMMALN = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return jStat.gammaln(number);
};
exports.GAMMALN.PRECISE = function (x) {
  if (arguments.length !== 1) {
    return error.na;
  }
  if (x <= 0) {
    return error.num;
  }
  if (typeof x !== 'number') {
    return error.value;
  }
  return jStat.gammaln(x);
};
exports.GAUSS = function (z) {
  z = utils.parseNumber(z);
  if (z instanceof Error) {
    return z;
  }
  return jStat.normal.cdf(z, 0, 1) - 0.5;
};
exports.GEOMEAN = function () {
  var args = utils.parseNumberArray(utils.flatten(arguments));
  if (args instanceof Error) {
    return args;
  }
  return jStat.geomean(args);
};
exports.GROWTH = function (known_y, known_x, new_x, use_const) {
  // Credits: Ilmari Karonen (http://stackoverflow.com/questions/14161990/how-to-implement-growth-function-in-javascript)

  known_y = utils.parseNumberArray(known_y);
  if (known_y instanceof Error) {
    return known_y;
  }

  // Default values for optional parameters:
  var i;
  if (known_x === undefined) {
    known_x = [];
    for (i = 1; i <= known_y.length; i++) {
      known_x.push(i);
    }
  }
  if (new_x === undefined) {
    new_x = [];
    for (i = 1; i <= known_y.length; i++) {
      new_x.push(i);
    }
  }
  known_x = utils.parseNumberArray(known_x);
  new_x = utils.parseNumberArray(new_x);
  if (utils.anyIsError(known_x, new_x)) {
    return error.value;
  }
  if (use_const === undefined) {
    use_const = true;
  }

  // Calculate sums over the data:
  var n = known_y.length;
  var avg_x = 0;
  var avg_y = 0;
  var avg_xy = 0;
  var avg_xx = 0;
  for (i = 0; i < n; i++) {
    var x = known_x[i];
    var y = Math.log(known_y[i]);
    avg_x += x;
    avg_y += y;
    avg_xy += x * y;
    avg_xx += x * x;
  }
  avg_x /= n;
  avg_y /= n;
  avg_xy /= n;
  avg_xx /= n;

  // Compute linear regression coefficients:
  var beta;
  var alpha;
  if (use_const) {
    beta = (avg_xy - avg_x * avg_y) / (avg_xx - avg_x * avg_x);
    alpha = avg_y - beta * avg_x;
  } else {
    beta = avg_xy / avg_xx;
    alpha = 0;
  }

  // Compute and return result array:
  var new_y = [];
  for (i = 0; i < new_x.length; i++) {
    new_y.push(Math.exp(alpha + beta * new_x[i]));
  }
  return new_y;
};
exports.HARMEAN = function () {
  var range = utils.parseNumberArray(utils.flatten(arguments));
  if (range instanceof Error) {
    return range;
  }
  var n = range.length;
  var den = 0;
  for (var i = 0; i < n; i++) {
    den += 1 / range[i];
  }
  return n / den;
};
exports.HYPGEOM = {};
exports.HYPGEOM.DIST = function (x, n, M, N, cumulative) {
  x = utils.parseNumber(x);
  n = utils.parseNumber(n);
  M = utils.parseNumber(M);
  N = utils.parseNumber(N);
  if (utils.anyIsError(x, n, M, N)) {
    return error.value;
  }
  function pdf(x, n, M, N) {
    return mathTrig.COMBIN(M, x) * mathTrig.COMBIN(N - M, n - x) / mathTrig.COMBIN(N, n);
  }
  function cdf(x, n, M, N) {
    var result = 0;
    for (var i = 0; i <= x; i++) {
      result += pdf(i, n, M, N);
    }
    return result;
  }
  return cumulative ? cdf(x, n, M, N) : pdf(x, n, M, N);
};
exports.INTERCEPT = function (known_y, known_x) {
  known_y = utils.parseNumberArray(known_y);
  known_x = utils.parseNumberArray(known_x);
  if (utils.anyIsError(known_y, known_x)) {
    return error.value;
  }
  if (known_y.length !== known_x.length) {
    return error.na;
  }
  return exports.FORECAST(0, known_y, known_x);
};
exports.KURT = function () {
  var range = utils.parseNumberArray(utils.flatten(arguments));
  if (range instanceof Error) {
    return range;
  }
  var mean = jStat.mean(range);
  var n = range.length;
  var sigma = 0;
  for (var i = 0; i < n; i++) {
    sigma += Math.pow(range[i] - mean, 4);
  }
  sigma = sigma / Math.pow(jStat.stdev(range, true), 4);
  return n * (n + 1) / ((n - 1) * (n - 2) * (n - 3)) * sigma - 3 * (n - 1) * (n - 1) / ((n - 2) * (n - 3));
};
exports.LARGE = function (range, k) {
  range = utils.parseNumberArray(utils.flatten(range));
  k = utils.parseNumber(k);
  if (utils.anyIsError(range, k)) {
    return range;
  }
  return range.sort(function (a, b) {
    return b - a;
  })[k - 1];
};
exports.LINEST = function (data_y, data_x) {
  data_y = utils.parseNumberArray(utils.flatten(data_y));
  data_x = utils.parseNumberArray(utils.flatten(data_x));
  if (utils.anyIsError(data_y, data_x)) {
    return error.value;
  }
  var ymean = jStat.mean(data_y);
  var xmean = jStat.mean(data_x);
  var n = data_x.length;
  var num = 0;
  var den = 0;
  for (var i = 0; i < n; i++) {
    num += (data_x[i] - xmean) * (data_y[i] - ymean);
    den += Math.pow(data_x[i] - xmean, 2);
  }
  var m = num / den;
  var b = ymean - m * xmean;
  return [m, b];
};

// According to Microsoft:
// http://office.microsoft.com/en-us/starter-help/logest-function-HP010342665.aspx
// LOGEST returns are based on the following linear model:
// ln y = x1 ln m1 + ... + xn ln mn + ln b
exports.LOGEST = function (data_y, data_x) {
  data_y = utils.parseNumberArray(utils.flatten(data_y));
  data_x = utils.parseNumberArray(utils.flatten(data_x));
  if (utils.anyIsError(data_y, data_x)) {
    return error.value;
  }
  for (var i = 0; i < data_y.length; i++) {
    data_y[i] = Math.log(data_y[i]);
  }
  var result = exports.LINEST(data_y, data_x);
  result[0] = Math.round(Math.exp(result[0]) * 1000000) / 1000000;
  result[1] = Math.round(Math.exp(result[1]) * 1000000) / 1000000;
  return result;
};
exports.LOGNORM = {};
exports.LOGNORM.DIST = function (x, mean, sd, cumulative) {
  x = utils.parseNumber(x);
  mean = utils.parseNumber(mean);
  sd = utils.parseNumber(sd);
  if (utils.anyIsError(x, mean, sd)) {
    return error.value;
  }
  return cumulative ? jStat.lognormal.cdf(x, mean, sd) : jStat.lognormal.pdf(x, mean, sd);
};
exports.LOGNORM.INV = function (probability, mean, sd) {
  probability = utils.parseNumber(probability);
  mean = utils.parseNumber(mean);
  sd = utils.parseNumber(sd);
  if (utils.anyIsError(probability, mean, sd)) {
    return error.value;
  }
  return jStat.lognormal.inv(probability, mean, sd);
};
exports.MAX = function () {
  var range = utils.numbers(utils.flatten(arguments));
  return range.length === 0 ? 0 : Math.max.apply(Math, range);
};
exports.MAXA = function () {
  var range = utils.arrayValuesToNumbers(utils.flatten(arguments));
  return range.length === 0 ? 0 : Math.max.apply(Math, range);
};
exports.MEDIAN = function () {
  var range = utils.arrayValuesToNumbers(utils.flatten(arguments));
  var result = jStat.median(range);
  if (isNaN(result)) {
    result = error.num;
  }
  return result;
};
exports.MIN = function () {
  var range = utils.numbers(utils.flatten(arguments));
  return range.length === 0 ? 0 : Math.min.apply(Math, range);
};
exports.MINA = function () {
  var range = utils.arrayValuesToNumbers(utils.flatten(arguments));
  return range.length === 0 ? 0 : Math.min.apply(Math, range);
};
exports.MODE = {};
exports.MODE.MULT = function () {
  // Credits: Roönaän
  var range = utils.parseNumberArray(utils.flatten(arguments));
  if (range instanceof Error) {
    return range;
  }
  var n = range.length;
  var count = {};
  var maxItems = [];
  var max = 0;
  var currentItem;
  for (var i = 0; i < n; i++) {
    currentItem = range[i];
    count[currentItem] = count[currentItem] ? count[currentItem] + 1 : 1;
    if (count[currentItem] > max) {
      max = count[currentItem];
      maxItems = [];
    }
    if (count[currentItem] === max) {
      maxItems[maxItems.length] = currentItem;
    }
  }
  return maxItems;
};
exports.MODE.SNGL = function () {
  var range = utils.parseNumberArray(utils.flatten(arguments));
  if (range instanceof Error) {
    return range;
  }
  return exports.MODE.MULT(range).sort(function (a, b) {
    return a - b;
  })[0];
};
exports.NEGBINOM = {};
exports.NEGBINOM.DIST = function (k, r, p, cumulative) {
  k = utils.parseNumber(k);
  r = utils.parseNumber(r);
  p = utils.parseNumber(p);
  if (utils.anyIsError(k, r, p)) {
    return error.value;
  }
  return cumulative ? jStat.negbin.cdf(k, r, p) : jStat.negbin.pdf(k, r, p);
};
exports.NORM = {};
exports.NORM.DIST = function (x, mean, sd, cumulative) {
  x = utils.parseNumber(x);
  mean = utils.parseNumber(mean);
  sd = utils.parseNumber(sd);
  if (utils.anyIsError(x, mean, sd)) {
    return error.value;
  }
  if (sd <= 0) {
    return error.num;
  }

  // Return normal distribution computed by jStat [http://jstat.org]
  return cumulative ? jStat.normal.cdf(x, mean, sd) : jStat.normal.pdf(x, mean, sd);
};
exports.NORM.INV = function (probability, mean, sd) {
  probability = utils.parseNumber(probability);
  mean = utils.parseNumber(mean);
  sd = utils.parseNumber(sd);
  if (utils.anyIsError(probability, mean, sd)) {
    return error.value;
  }
  return jStat.normal.inv(probability, mean, sd);
};
exports.NORM.S = {};
exports.NORM.S.DIST = function (z, cumulative) {
  z = utils.parseNumber(z);
  if (z instanceof Error) {
    return error.value;
  }
  return cumulative ? jStat.normal.cdf(z, 0, 1) : jStat.normal.pdf(z, 0, 1);
};
exports.NORM.S.INV = function (probability) {
  probability = utils.parseNumber(probability);
  if (probability instanceof Error) {
    return error.value;
  }
  return jStat.normal.inv(probability, 0, 1);
};
exports.PEARSON = function (data_x, data_y) {
  data_y = utils.parseNumberArray(utils.flatten(data_y));
  data_x = utils.parseNumberArray(utils.flatten(data_x));
  if (utils.anyIsError(data_y, data_x)) {
    return error.value;
  }
  var xmean = jStat.mean(data_x);
  var ymean = jStat.mean(data_y);
  var n = data_x.length;
  var num = 0;
  var den1 = 0;
  var den2 = 0;
  for (var i = 0; i < n; i++) {
    num += (data_x[i] - xmean) * (data_y[i] - ymean);
    den1 += Math.pow(data_x[i] - xmean, 2);
    den2 += Math.pow(data_y[i] - ymean, 2);
  }
  return num / Math.sqrt(den1 * den2);
};
exports.PERCENTILE = {};
exports.PERCENTILE.EXC = function (array, k) {
  array = utils.parseNumberArray(utils.flatten(array));
  k = utils.parseNumber(k);
  if (utils.anyIsError(array, k)) {
    return error.value;
  }
  array = array.sort(function (a, b) {
    {
      return a - b;
    }
  });
  var n = array.length;
  if (k < 1 / (n + 1) || k > 1 - 1 / (n + 1)) {
    return error.num;
  }
  var l = k * (n + 1) - 1;
  var fl = Math.floor(l);
  return utils.cleanFloat(l === fl ? array[l] : array[fl] + (l - fl) * (array[fl + 1] - array[fl]));
};
exports.PERCENTILE.INC = function (array, k) {
  array = utils.parseNumberArray(utils.flatten(array));
  k = utils.parseNumber(k);
  if (utils.anyIsError(array, k)) {
    return error.value;
  }
  array = array.sort(function (a, b) {
    return a - b;
  });
  var n = array.length;
  var l = k * (n - 1);
  var fl = Math.floor(l);
  return utils.cleanFloat(l === fl ? array[l] : array[fl] + (l - fl) * (array[fl + 1] - array[fl]));
};
exports.PERCENTRANK = {};
exports.PERCENTRANK.EXC = function (array, x, significance) {
  significance = significance === undefined ? 3 : significance;
  array = utils.parseNumberArray(utils.flatten(array));
  x = utils.parseNumber(x);
  significance = utils.parseNumber(significance);
  if (utils.anyIsError(array, x, significance)) {
    return error.value;
  }
  array = array.sort(function (a, b) {
    return a - b;
  });
  var uniques = misc.UNIQUE.apply(null, array);
  var n = array.length;
  var m = uniques.length;
  var power = Math.pow(10, significance);
  var result = 0;
  var match = false;
  var i = 0;
  while (!match && i < m) {
    if (x === uniques[i]) {
      result = (array.indexOf(uniques[i]) + 1) / (n + 1);
      match = true;
    } else if (x >= uniques[i] && (x < uniques[i + 1] || i === m - 1)) {
      result = (array.indexOf(uniques[i]) + 1 + (x - uniques[i]) / (uniques[i + 1] - uniques[i])) / (n + 1);
      match = true;
    }
    i++;
  }
  return Math.floor(result * power) / power;
};
exports.PERCENTRANK.INC = function (array, x, significance) {
  significance = significance === undefined ? 3 : significance;
  array = utils.parseNumberArray(utils.flatten(array));
  x = utils.parseNumber(x);
  significance = utils.parseNumber(significance);
  if (utils.anyIsError(array, x, significance)) {
    return error.value;
  }
  array = array.sort(function (a, b) {
    return a - b;
  });
  var uniques = misc.UNIQUE.apply(null, array);
  var n = array.length;
  var m = uniques.length;
  var power = Math.pow(10, significance);
  var result = 0;
  var match = false;
  var i = 0;
  while (!match && i < m) {
    if (x === uniques[i]) {
      result = array.indexOf(uniques[i]) / (n - 1);
      match = true;
    } else if (x >= uniques[i] && (x < uniques[i + 1] || i === m - 1)) {
      result = (array.indexOf(uniques[i]) + (x - uniques[i]) / (uniques[i + 1] - uniques[i])) / (n - 1);
      match = true;
    }
    i++;
  }
  return Math.floor(result * power) / power;
};
exports.PERMUT = function (number, number_chosen) {
  number = utils.parseNumber(number);
  number_chosen = utils.parseNumber(number_chosen);
  if (utils.anyIsError(number, number_chosen)) {
    return error.value;
  }
  return mathTrig.FACT(number) / mathTrig.FACT(number - number_chosen);
};
exports.PERMUTATIONA = function (number, number_chosen) {
  number = utils.parseNumber(number);
  number_chosen = utils.parseNumber(number_chosen);
  if (utils.anyIsError(number, number_chosen)) {
    return error.value;
  }
  return Math.pow(number, number_chosen);
};
exports.PHI = function (x) {
  x = utils.parseNumber(x);
  if (x instanceof Error) {
    return error.value;
  }
  return Math.exp(-0.5 * x * x) / SQRT2PI;
};
exports.POISSON = {};
exports.POISSON.DIST = function (x, mean, cumulative) {
  x = utils.parseNumber(x);
  mean = utils.parseNumber(mean);
  if (utils.anyIsError(x, mean)) {
    return error.value;
  }
  return cumulative ? jStat.poisson.cdf(x, mean) : jStat.poisson.pdf(x, mean);
};
exports.PROB = function (range, probability, lower, upper) {
  if (lower === undefined) {
    return 0;
  }
  upper = upper === undefined ? lower : upper;
  range = utils.parseNumberArray(utils.flatten(range));
  probability = utils.parseNumberArray(utils.flatten(probability));
  lower = utils.parseNumber(lower);
  upper = utils.parseNumber(upper);
  if (utils.anyIsError(range, probability, lower, upper)) {
    return error.value;
  }
  if (lower === upper) {
    return range.indexOf(lower) >= 0 ? probability[range.indexOf(lower)] : 0;
  }
  var sorted = range.sort(function (a, b) {
    return a - b;
  });
  var n = sorted.length;
  var result = 0;
  for (var i = 0; i < n; i++) {
    if (sorted[i] >= lower && sorted[i] <= upper) {
      result += probability[range.indexOf(sorted[i])];
    }
  }
  return result;
};
exports.QUARTILE = {};
exports.QUARTILE.EXC = function (range, quart) {
  range = utils.parseNumberArray(utils.flatten(range));
  quart = utils.parseNumber(quart);
  if (utils.anyIsError(range, quart)) {
    return error.value;
  }
  switch (quart) {
    case 1:
      return exports.PERCENTILE.EXC(range, 0.25);
    case 2:
      return exports.PERCENTILE.EXC(range, 0.5);
    case 3:
      return exports.PERCENTILE.EXC(range, 0.75);
    default:
      return error.num;
  }
};
exports.QUARTILE.INC = function (range, quart) {
  range = utils.parseNumberArray(utils.flatten(range));
  quart = utils.parseNumber(quart);
  if (utils.anyIsError(range, quart)) {
    return error.value;
  }
  switch (quart) {
    case 1:
      return exports.PERCENTILE.INC(range, 0.25);
    case 2:
      return exports.PERCENTILE.INC(range, 0.5);
    case 3:
      return exports.PERCENTILE.INC(range, 0.75);
    default:
      return error.num;
  }
};
exports.RANK = {};
exports.RANK.AVG = function (number, range, order) {
  number = utils.parseNumber(number);
  range = utils.parseNumberArray(utils.flatten(range));
  if (utils.anyIsError(number, range)) {
    return error.value;
  }
  range = utils.flatten(range);
  order = order || false;
  var sort = order ? function (a, b) {
    return a - b;
  } : function (a, b) {
    return b - a;
  };
  range = range.sort(sort);
  var length = range.length;
  var count = 0;
  for (var i = 0; i < length; i++) {
    if (range[i] === number) {
      count++;
    }
  }
  return count > 1 ? (2 * range.indexOf(number) + count + 1) / 2 : range.indexOf(number) + 1;
};
exports.RANK.EQ = function (number, range, order) {
  number = utils.parseNumber(number);
  range = utils.parseNumberArray(utils.flatten(range));
  if (utils.anyIsError(number, range)) {
    return error.value;
  }
  order = order || false;
  var sort = order ? function (a, b) {
    return a - b;
  } : function (a, b) {
    return b - a;
  };
  range = range.sort(sort);
  return range.indexOf(number) + 1;
};
exports.ROW = function (matrix, index) {
  if (arguments.length !== 2) {
    return error.na;
  }
  if (index < 0) {
    return error.num;
  }
  if (!(matrix instanceof Array) || typeof index !== 'number') {
    return error.value;
  }
  if (matrix.length === 0) {
    return undefined;
  }
  return jStat.row(matrix, index);
};
exports.ROWS = function (matrix) {
  if (arguments.length !== 1) {
    return error.na;
  }
  if (!(matrix instanceof Array)) {
    return error.value;
  }
  if (matrix.length === 0) {
    return 0;
  }
  return jStat.rows(matrix);
};
exports.RSQ = function (data_x, data_y) {
  // no need to flatten here, PEARSON will take care of that
  data_x = utils.parseNumberArray(utils.flatten(data_x));
  data_y = utils.parseNumberArray(utils.flatten(data_y));
  if (utils.anyIsError(data_x, data_y)) {
    return error.value;
  }
  return Math.pow(exports.PEARSON(data_x, data_y), 2);
};
exports.SKEW = function () {
  var range = utils.parseNumberArray(utils.flatten(arguments));
  if (range instanceof Error) {
    return range;
  }
  var mean = jStat.mean(range);
  var n = range.length;
  var sigma = 0;
  for (var i = 0; i < n; i++) {
    sigma += Math.pow(range[i] - mean, 3);
  }
  return n * sigma / ((n - 1) * (n - 2) * Math.pow(jStat.stdev(range, true), 3));
};
exports.SKEW.P = function () {
  var range = utils.parseNumberArray(utils.flatten(arguments));
  if (range instanceof Error) {
    return range;
  }
  var mean = jStat.mean(range);
  var n = range.length;
  var m2 = 0;
  var m3 = 0;
  for (var i = 0; i < n; i++) {
    m3 += Math.pow(range[i] - mean, 3);
    m2 += Math.pow(range[i] - mean, 2);
  }
  m3 = m3 / n;
  m2 = m2 / n;
  return m3 / Math.pow(m2, 3 / 2);
};
exports.SLOPE = function (data_y, data_x) {
  data_y = utils.parseNumberArray(utils.flatten(data_y));
  data_x = utils.parseNumberArray(utils.flatten(data_x));
  if (utils.anyIsError(data_y, data_x)) {
    return error.value;
  }
  var xmean = jStat.mean(data_x);
  var ymean = jStat.mean(data_y);
  var n = data_x.length;
  var num = 0;
  var den = 0;
  for (var i = 0; i < n; i++) {
    num += (data_x[i] - xmean) * (data_y[i] - ymean);
    den += Math.pow(data_x[i] - xmean, 2);
  }
  return num / den;
};
exports.SMALL = function (range, k) {
  range = utils.parseNumberArray(utils.flatten(range));
  k = utils.parseNumber(k);
  if (utils.anyIsError(range, k)) {
    return range;
  }
  return range.sort(function (a, b) {
    return a - b;
  })[k - 1];
};
exports.STANDARDIZE = function (x, mean, sd) {
  x = utils.parseNumber(x);
  mean = utils.parseNumber(mean);
  sd = utils.parseNumber(sd);
  if (utils.anyIsError(x, mean, sd)) {
    return error.value;
  }
  return (x - mean) / sd;
};
exports.STDEV = {};
exports.STDEV.P = function () {
  var v = exports.VAR.P.apply(this, arguments);
  var result = Math.sqrt(v);
  if (isNaN(result)) {
    result = error.num;
  }
  return result;
};
exports.STDEV.S = function () {
  var v = exports.VAR.S.apply(this, arguments);
  var result = Math.sqrt(v);
  return result;
};
exports.STDEVA = function () {
  var v = exports.VARA.apply(this, arguments);
  var result = Math.sqrt(v);
  return result;
};
exports.STDEVPA = function () {
  var v = exports.VARPA.apply(this, arguments);
  var result = Math.sqrt(v);
  if (isNaN(result)) {
    result = error.num;
  }
  return result;
};
exports.STEYX = function (data_y, data_x) {
  data_y = utils.parseNumberArray(utils.flatten(data_y));
  data_x = utils.parseNumberArray(utils.flatten(data_x));
  if (utils.anyIsError(data_y, data_x)) {
    return error.value;
  }
  var xmean = jStat.mean(data_x);
  var ymean = jStat.mean(data_y);
  var n = data_x.length;
  var lft = 0;
  var num = 0;
  var den = 0;
  for (var i = 0; i < n; i++) {
    lft += Math.pow(data_y[i] - ymean, 2);
    num += (data_x[i] - xmean) * (data_y[i] - ymean);
    den += Math.pow(data_x[i] - xmean, 2);
  }
  return Math.sqrt((lft - num * num / den) / (n - 2));
};
exports.TRANSPOSE = function (matrix) {
  if (!matrix) {
    return error.na;
  }
  return jStat.transpose(matrix);
};
exports.T = text.T;
exports.T.DIST = function (x, df, cumulative) {
  x = utils.parseNumber(x);
  df = utils.parseNumber(df);
  if (utils.anyIsError(x, df)) {
    return error.value;
  }
  return cumulative ? jStat.studentt.cdf(x, df) : jStat.studentt.pdf(x, df);
};
exports.T.DIST["2T"] = function (x, df) {
  if (arguments.length !== 2) {
    return error.na;
  }
  if (x < 0 || df < 1) {
    return error.num;
  }
  if (typeof x !== 'number' || typeof df !== 'number') {
    return error.value;
  }
  return (1 - jStat.studentt.cdf(x, df)) * 2;
};
exports.T.DIST.RT = function (x, df) {
  if (arguments.length !== 2) {
    return error.na;
  }
  if (x < 0 || df < 1) {
    return error.num;
  }
  if (typeof x !== 'number' || typeof df !== 'number') {
    return error.value;
  }
  return 1 - jStat.studentt.cdf(x, df);
};
exports.T.INV = function (probability, df) {
  probability = utils.parseNumber(probability);
  df = utils.parseNumber(df);
  if (utils.anyIsError(probability, df)) {
    return error.value;
  }
  return jStat.studentt.inv(probability, df);
};
exports.T.INV["2T"] = function (probability, df) {
  probability = utils.parseNumber(probability);
  df = utils.parseNumber(df);
  if (probability <= 0 || probability > 1 || df < 1) {
    return error.num;
  }
  if (utils.anyIsError(probability, df)) {
    return error.value;
  }
  return Math.abs(jStat.studentt.inv(probability / 2, df));
};

// The algorithm can be found here:
// http://www.chem.uoa.gr/applets/AppletTtest/Appl_Ttest2.html
exports.T.TEST = function (data_x, data_y) {
  data_x = utils.parseNumberArray(utils.flatten(data_x));
  data_y = utils.parseNumberArray(utils.flatten(data_y));
  if (utils.anyIsError(data_x, data_y)) {
    return error.value;
  }
  var mean_x = jStat.mean(data_x);
  var mean_y = jStat.mean(data_y);
  var s_x = 0;
  var s_y = 0;
  var i;
  for (i = 0; i < data_x.length; i++) {
    s_x += Math.pow(data_x[i] - mean_x, 2);
  }
  for (i = 0; i < data_y.length; i++) {
    s_y += Math.pow(data_y[i] - mean_y, 2);
  }
  s_x = s_x / (data_x.length - 1);
  s_y = s_y / (data_y.length - 1);
  var t = Math.abs(mean_x - mean_y) / Math.sqrt(s_x / data_x.length + s_y / data_y.length);
  return exports.T.DIST['2T'](t, data_x.length + data_y.length - 2);
};
exports.TREND = function (data_y, data_x, new_data_x) {
  data_y = utils.parseNumberArray(utils.flatten(data_y));
  data_x = utils.parseNumberArray(utils.flatten(data_x));
  new_data_x = utils.parseNumberArray(utils.flatten(new_data_x));
  if (utils.anyIsError(data_y, data_x, new_data_x)) {
    return error.value;
  }
  var linest = exports.LINEST(data_y, data_x);
  var m = linest[0];
  var b = linest[1];
  var result = [];
  new_data_x.forEach(function (x) {
    result.push(m * x + b);
  });
  return result;
};
exports.TRIMMEAN = function (range, percent) {
  range = utils.parseNumberArray(utils.flatten(range));
  percent = utils.parseNumber(percent);
  if (utils.anyIsError(range, percent)) {
    return error.value;
  }
  var trim = mathTrig.FLOOR(range.length * percent, 2) / 2;
  return jStat.mean(utils.initial(utils.rest(range.sort(function (a, b) {
    return a - b;
  }), trim), trim));
};
exports.VAR = {};
exports.VAR.P = function () {
  var range = utils.numbers(utils.flatten(arguments));
  var n = range.length;
  var sigma = 0;
  var mean = exports.AVERAGE(range);
  var result;
  for (var i = 0; i < n; i++) {
    sigma += Math.pow(range[i] - mean, 2);
  }
  result = sigma / n;
  if (isNaN(result)) {
    result = error.num;
  }
  return result;
};
exports.VAR.S = function () {
  var range = utils.numbers(utils.flatten(arguments));
  var n = range.length;
  var sigma = 0;
  var mean = exports.AVERAGE(range);
  for (var i = 0; i < n; i++) {
    sigma += Math.pow(range[i] - mean, 2);
  }
  return sigma / (n - 1);
};
exports.VARA = function () {
  var range = utils.flatten(arguments);
  var n = range.length;
  var sigma = 0;
  var count = 0;
  var mean = exports.AVERAGEA(range);
  for (var i = 0; i < n; i++) {
    var el = range[i];
    if (typeof el === 'number') {
      sigma += Math.pow(el - mean, 2);
    } else if (el === true) {
      sigma += Math.pow(1 - mean, 2);
    } else {
      sigma += Math.pow(0 - mean, 2);
    }
    if (el !== null) {
      count++;
    }
  }
  return sigma / (count - 1);
};
exports.VARPA = function () {
  var range = utils.flatten(arguments);
  var n = range.length;
  var sigma = 0;
  var count = 0;
  var mean = exports.AVERAGEA(range);
  var result;
  for (var i = 0; i < n; i++) {
    var el = range[i];
    if (typeof el === 'number') {
      sigma += Math.pow(el - mean, 2);
    } else if (el === true) {
      sigma += Math.pow(1 - mean, 2);
    } else {
      sigma += Math.pow(0 - mean, 2);
    }
    if (el !== null) {
      count++;
    }
  }
  result = sigma / count;
  if (isNaN(result)) {
    result = error.num;
  }
  return result;
};
exports.WEIBULL = {};
exports.WEIBULL.DIST = function (x, alpha, beta, cumulative) {
  x = utils.parseNumber(x);
  alpha = utils.parseNumber(alpha);
  beta = utils.parseNumber(beta);
  if (utils.anyIsError(x, alpha, beta)) {
    return error.value;
  }
  return cumulative ? 1 - Math.exp(-Math.pow(x / beta, alpha)) : Math.pow(x, alpha - 1) * Math.exp(-Math.pow(x / beta, alpha)) * alpha / Math.pow(beta, alpha);
};
exports.Z = {};
exports.Z.TEST = function (range, x, sd) {
  range = utils.parseNumberArray(utils.flatten(range));
  x = utils.parseNumber(x);
  if (utils.anyIsError(range, x)) {
    return error.value;
  }
  sd = sd || exports.STDEV.S(range);
  var n = range.length;
  return 1 - exports.NORM.S.DIST((exports.AVERAGE(range) - x) / (sd / Math.sqrt(n)), true);
};

/***/ }),

/***/ 2328:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

var utils = __webpack_require__(2593);
var error = __webpack_require__(5734);

//TODO
exports.ASC = function () {
  throw new Error('ASC is not implemented');
};

//TODO
exports.BAHTTEXT = function () {
  throw new Error('BAHTTEXT is not implemented');
};
exports.CHAR = function (number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return String.fromCharCode(number);
};
exports.CLEAN = function (text) {
  text = text || '';
  var re = /[\0-\x1F]/g;
  return text.replace(re, "");
};
exports.CODE = function (text) {
  text = text || '';
  var result = text.charCodeAt(0);
  if (isNaN(result)) {
    result = error.na;
  }
  return result;
};
exports.CONCATENATE = function () {
  var args = utils.flatten(arguments);
  var trueFound = 0;
  while ((trueFound = args.indexOf(true)) > -1) {
    args[trueFound] = 'TRUE';
  }
  var falseFound = 0;
  while ((falseFound = args.indexOf(false)) > -1) {
    args[falseFound] = 'FALSE';
  }
  return args.join('');
};

//TODO
exports.DBCS = function () {
  throw new Error('DBCS is not implemented');
};

//TODO
exports.DOLLAR = function () {
  throw new Error('DOLLAR is not implemented');
};
exports.EXACT = function (text1, text2) {
  if (arguments.length !== 2) {
    return error.na;
  }
  return text1 === text2;
};
exports.FIND = function (find_text, within_text, position) {
  if (arguments.length < 2) {
    return error.na;
  }
  position = position === undefined ? 0 : position;
  return within_text ? within_text.indexOf(find_text, position - 1) + 1 : null;
};

//TODO
exports.FIXED = function () {
  throw new Error('FIXED is not implemented');
};
exports.HTML2TEXT = function (value) {
  var result = '';
  if (value) {
    if (value instanceof Array) {
      value.forEach(function (line) {
        if (result !== '') {
          result += '\n';
        }
        result += line.replace(/<(?:.|\n)*?>/gm, '');
      });
    } else {
      result = value.replace(/<(?:.|\n)*?>/gm, '');
    }
  }
  return result;
};
exports.LEFT = function (text, number) {
  number = number === undefined ? 1 : number;
  number = utils.parseNumber(number);
  if (number instanceof Error || typeof text !== 'string') {
    return error.value;
  }
  return text ? text.substring(0, number) : null;
};
exports.LEN = function (text) {
  if (arguments.length === 0) {
    return error.error;
  }
  if (typeof text === 'string') {
    return text ? text.length : 0;
  }
  if (text.length) {
    return text.length;
  }
  return error.value;
};
exports.LOWER = function (text) {
  if (typeof text !== 'string') {
    return error.value;
  }
  return text ? text.toLowerCase() : text;
};
exports.MID = function (text, start, number) {
  start = utils.parseNumber(start);
  number = utils.parseNumber(number);
  if (utils.anyIsError(start, number) || typeof text !== 'string') {
    return number;
  }
  var begin = start - 1;
  var end = begin + number;
  return text.substring(begin, end);
};

// TODO
exports.NUMBERVALUE = function (text, decimal_separator, group_separator) {
  decimal_separator = typeof decimal_separator === 'undefined' ? '.' : decimal_separator;
  group_separator = typeof group_separator === 'undefined' ? ',' : group_separator;
  return Number(text.replace(decimal_separator, '.').replace(group_separator, ''));
};

// TODO
exports.PRONETIC = function () {
  throw new Error('PRONETIC is not implemented');
};
exports.PROPER = function (text) {
  if (text === undefined || text.length === 0) {
    return error.value;
  }
  if (text === true) {
    text = 'TRUE';
  }
  if (text === false) {
    text = 'FALSE';
  }
  if (isNaN(text) && typeof text === 'number') {
    return error.value;
  }
  if (typeof text === 'number') {
    text = '' + text;
  }
  return text.replace(/\w\S*/g, function (txt) {
    return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
  });
};
exports.REGEXEXTRACT = function (text, regular_expression) {
  if (arguments.length < 2) {
    return error.na;
  }
  var match = text.match(new RegExp(regular_expression));
  return match ? match[match.length > 1 ? match.length - 1 : 0] : null;
};
exports.REGEXMATCH = function (text, regular_expression, full) {
  if (arguments.length < 2) {
    return error.na;
  }
  var match = text.match(new RegExp(regular_expression));
  return full ? match : !!match;
};
exports.REGEXREPLACE = function (text, regular_expression, replacement) {
  if (arguments.length < 3) {
    return error.na;
  }
  return text.replace(new RegExp(regular_expression), replacement);
};
exports.REPLACE = function (text, position, length, new_text) {
  position = utils.parseNumber(position);
  length = utils.parseNumber(length);
  if (utils.anyIsError(position, length) || typeof text !== 'string' || typeof new_text !== 'string') {
    return error.value;
  }
  return text.substr(0, position - 1) + new_text + text.substr(position - 1 + length);
};
exports.REPT = function (text, number) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return new Array(number + 1).join(text);
};
exports.RIGHT = function (text, number) {
  number = number === undefined ? 1 : number;
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
  return text ? text.substring(text.length - number) : error.na;
};
exports.SEARCH = function (find_text, within_text, position) {
  var foundAt;
  if (typeof find_text !== 'string' || typeof within_text !== 'string') {
    return error.value;
  }
  position = position === undefined ? 0 : position;
  foundAt = within_text.toLowerCase().indexOf(find_text.toLowerCase(), position - 1) + 1;
  return foundAt === 0 ? error.value : foundAt;
};
exports.SPLIT = function (text, separator) {
  return text.split(separator);
};
exports.SUBSTITUTE = function (text, old_text, new_text, occurrence) {
  if (arguments.length < 2) {
    return error.na;
  }
  if (!text || !old_text || !new_text) {
    return text;
  } else if (occurrence === undefined) {
    return text.replace(new RegExp(old_text, 'g'), new_text);
  } else {
    var index = 0;
    var i = 0;
    while (text.indexOf(old_text, index) > 0) {
      index = text.indexOf(old_text, index + 1);
      i++;
      if (i === occurrence) {
        return text.substring(0, index) + new_text + text.substring(index + old_text.length);
      }
    }
  }
};
exports.T = function (value) {
  return typeof value === "string" ? value : '';
};

// TODO incomplete implementation
exports.TEXT = function () {
  throw new Error('TEXT is not implemented');
};
exports.TRIM = function (text) {
  if (typeof text !== 'string') {
    return error.value;
  }
  return text.replace(/ +/g, ' ').trim();
};
exports.UNICHAR = exports.CHAR;
exports.UNICODE = exports.CODE;
exports.UPPER = function (text) {
  if (typeof text !== 'string') {
    return error.value;
  }
  return text.toUpperCase();
};

//TODO
exports.VALUE = function () {
  throw new Error('VALUE is not implemented');
};

/***/ }),

/***/ 2593:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

var error = __webpack_require__(5734);
exports.flattenShallow = function (array) {
  if (!array || !array.reduce) {
    return array;
  }
  return array.reduce(function (a, b) {
    var aIsArray = Array.isArray(a);
    var bIsArray = Array.isArray(b);
    if (aIsArray && bIsArray) {
      return a.concat(b);
    }
    if (aIsArray) {
      a.push(b);
      return a;
    }
    if (bIsArray) {
      return [a].concat(b);
    }
    return [a, b];
  });
};
exports.isFlat = function (array) {
  if (!array) {
    return false;
  }
  for (var i = 0; i < array.length; ++i) {
    if (Array.isArray(array[i])) {
      return false;
    }
  }
  return true;
};
exports.flatten = function () {
  var result = exports.argsToArray.apply(null, arguments);
  while (!exports.isFlat(result)) {
    result = exports.flattenShallow(result);
  }
  return result;
};
exports.argsToArray = function (args) {
  var result = [];
  exports.arrayEach(args, function (value) {
    result.push(value);
  });
  return result;
};
exports.numbers = function () {
  var possibleNumbers = this.flatten.apply(null, arguments);
  return possibleNumbers.filter(function (el) {
    return typeof el === 'number';
  });
};
exports.cleanFloat = function (number) {
  var power = 1e14;
  return Math.round(number * power) / power;
};
exports.parseBool = function (bool) {
  if (typeof bool === 'boolean') {
    return bool;
  }
  if (bool instanceof Error) {
    return bool;
  }
  if (typeof bool === 'number') {
    return bool !== 0;
  }
  if (typeof bool === 'string') {
    var up = bool.toUpperCase();
    if (up === 'TRUE') {
      return true;
    }
    if (up === 'FALSE') {
      return false;
    }
  }
  if (bool instanceof Date && !isNaN(bool)) {
    return true;
  }
  return error.value;
};
exports.parseNumber = function (string) {
  if (string === undefined || string === '') {
    return error.value;
  }
  if (!isNaN(string)) {
    return parseFloat(string);
  }
  return error.value;
};
exports.parseNumberArray = function (arr) {
  var len;
  if (!arr || (len = arr.length) === 0) {
    return error.value;
  }
  var parsed;
  while (len--) {
    parsed = exports.parseNumber(arr[len]);
    if (parsed === error.value) {
      return parsed;
    }
    arr[len] = parsed;
  }
  return arr;
};
exports.parseMatrix = function (matrix) {
  var n;
  if (!matrix || (n = matrix.length) === 0) {
    return error.value;
  }
  var pnarr;
  for (var i = 0; i < matrix.length; i++) {
    pnarr = exports.parseNumberArray(matrix[i]);
    matrix[i] = pnarr;
    if (pnarr instanceof Error) {
      return pnarr;
    }
  }
  return matrix;
};
var d1900 = new Date(Date.UTC(1900, 0, 1));
exports.parseDate = function (date) {
  if (!isNaN(date)) {
    if (date instanceof Date) {
      return new Date(date);
    }
    var d = parseInt(date, 10);
    if (d < 0) {
      return error.num;
    }
    if (d <= 60) {
      return new Date(d1900.getTime() + (d - 1) * 86400000);
    }
    return new Date(d1900.getTime() + (d - 2) * 86400000);
  }
  if (typeof date === 'string') {
    date = new Date(date);
    if (!isNaN(date)) {
      return date;
    }
  }
  return error.value;
};
exports.parseDateArray = function (arr) {
  var len = arr.length;
  var parsed;
  while (len--) {
    parsed = this.parseDate(arr[len]);
    if (parsed === error.value) {
      return parsed;
    }
    arr[len] = parsed;
  }
  return arr;
};
exports.anyIsError = function () {
  var n = arguments.length;
  while (n--) {
    if (arguments[n] instanceof Error) {
      return true;
    }
  }
  return false;
};
exports.arrayValuesToNumbers = function (arr) {
  var n = arr.length;
  var el;
  while (n--) {
    el = arr[n];
    if (typeof el === 'number') {
      continue;
    }
    if (el === true) {
      arr[n] = 1;
      continue;
    }
    if (el === false) {
      arr[n] = 0;
      continue;
    }
    if (typeof el === 'string') {
      var number = this.parseNumber(el);
      if (number instanceof Error) {
        arr[n] = 0;
      } else {
        arr[n] = number;
      }
    }
  }
  return arr;
};
exports.rest = function (array, idx) {
  idx = idx || 1;
  if (!array || typeof array.slice !== 'function') {
    return array;
  }
  return array.slice(idx);
};
exports.initial = function (array, idx) {
  idx = idx || 1;
  if (!array || typeof array.slice !== 'function') {
    return array;
  }
  return array.slice(0, array.length - idx);
};
exports.arrayEach = function (array, iteratee) {
  var index = -1,
    length = array.length;
  while (++index < length) {
    if (iteratee(array[index], index, array) === false) {
      break;
    }
  }
  return array;
};
exports.transpose = function (matrix) {
  if (!matrix) {
    return error.value;
  }
  return matrix[0].map(function (col, i) {
    return matrix.map(function (row) {
      return row[i];
    });
  });
};

/***/ }),

/***/ 2933:
/***/ ((__unused_webpack_module, exports) => {

var defaultOperator = '=';
var validSymbols = ['>', '>=', '<', '<=', '=', '<>'];
var TOKEN_TYPE_OPERATOR = 'operator';
var TOKEN_TYPE_LITERAL = 'literal';
var SUPPORTED_TOKENS = [TOKEN_TYPE_OPERATOR, TOKEN_TYPE_LITERAL];
exports.TOKEN_TYPE_OPERATOR = TOKEN_TYPE_OPERATOR;
exports.TOKEN_TYPE_LITERAL = TOKEN_TYPE_LITERAL;

/**
 * Create token which describe passed symbol/value.
 *
 * @param {String} value Value/Symbol to describe.
 * @param {String} type Type of the token 'operator' or 'literal'.
 * @return {Object}
 */
function createToken(value, type) {
  if (SUPPORTED_TOKENS.indexOf(type) === -1) {
    throw new Error('Unsupported token type: ' + type);
  }
  return {
    value: value,
    type: type
  };
}

/**
 * Tries to cast numeric values to their type passed as a string.
 *
 * @param {*} value
 * @return {*}
 */
function castValueToCorrectType(value) {
  if (typeof value !== 'string') {
    return value;
  }
  if (/^\d+(\.\d+)?$/.test(value)) {
    value = value.indexOf('.') === -1 ? parseInt(value, 10) : parseFloat(value);
  }
  return value;
}

/**
 * Generate stream of tokens from passed expression.
 *
 * @param {String} expression
 * @return {String[]}
 */
function tokenizeExpression(expression) {
  var expressionLength = expression.length;
  var tokens = [];
  var cursorIndex = 0;
  var processedValue = '';
  var processedSymbol = '';
  while (cursorIndex < expressionLength) {
    var char = expression.charAt(cursorIndex);
    switch (char) {
      case '>':
      case '<':
      case '=':
        processedSymbol = processedSymbol + char;
        if (processedValue.length > 0) {
          tokens.push(processedValue);
          processedValue = '';
        }
        break;
      default:
        if (processedSymbol.length > 0) {
          tokens.push(processedSymbol);
          processedSymbol = '';
        }
        processedValue = processedValue + char;
        break;
    }
    cursorIndex++;
  }
  if (processedValue.length > 0) {
    tokens.push(processedValue);
  }
  if (processedSymbol.length > 0) {
    tokens.push(processedSymbol);
  }
  return tokens;
}
;

/**
 * Analyze and convert tokens to an object which describes their meaning.
 *
 * @param {String[]} tokens
 * @return {Object[]}
 */
function analyzeTokens(tokens) {
  var literalValue = '';
  var analyzedTokens = [];
  for (var i = 0; i < tokens.length; i++) {
    var token = tokens[i];
    if (i === 0 && validSymbols.indexOf(token) >= 0) {
      analyzedTokens.push(createToken(token, TOKEN_TYPE_OPERATOR));
    } else {
      literalValue += token;
    }
  }
  if (literalValue.length > 0) {
    analyzedTokens.push(createToken(castValueToCorrectType(literalValue), TOKEN_TYPE_LITERAL));
  }
  if (analyzedTokens.length > 0 && analyzedTokens[0].type !== TOKEN_TYPE_OPERATOR) {
    analyzedTokens.unshift(createToken(defaultOperator, TOKEN_TYPE_OPERATOR));
  }
  return analyzedTokens;
}
;

/**
 * Compute/Evaluate an expression passed as an array of tokens.
 *
 * @param {Object[]} tokens
 * @return {Boolean}
 */
function computeExpression(tokens) {
  var values = [];
  var operator;
  for (var i = 0; i < tokens.length; i++) {
    var token = tokens[i];
    switch (token.type) {
      case TOKEN_TYPE_OPERATOR:
        operator = token.value;
        break;
      case TOKEN_TYPE_LITERAL:
        values.push(token.value);
        break;
    }
  }
  return evaluate(values, operator);
}
;

/**
 * Evaluate values based on passed math operator.
 *
 * @param {*} values
 * @param {String} operator
 * @return {Boolean}
 */
function evaluate(values, operator) {
  var result = false;
  switch (operator) {
    case '>':
      result = values[0] > values[1];
      break;
    case '>=':
      result = values[0] >= values[1];
      break;
    case '<':
      result = values[0] < values[1];
      break;
    case '<=':
      result = values[0] <= values[1];
      break;
    case '=':
      result = values[0] == values[1];
      break;
    case '<>':
      result = values[0] != values[1];
      break;
  }
  return result;
}
exports.parse = function (expression) {
  return analyzeTokens(tokenizeExpression(expression));
};
exports.createToken = createToken;
exports.compute = computeExpression;

/***/ }),

/***/ 5734:
/***/ ((__unused_webpack_module, exports) => {

exports.nil = new Error('#NULL!');
exports.div0 = new Error('#DIV/0!');
exports.value = new Error('#VALUE!');
exports.ref = new Error('#REF!');
exports.name = new Error('#NAME?');
exports.num = new Error('#NUM!');
exports.na = new Error('#N/A');
exports.error = new Error('#ERROR!');
exports.data = new Error('#GETTING_DATA');

/***/ }),

/***/ 4725:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";
/* provided dependency */ var process = __webpack_require__(8924);
/* provided dependency */ var console = __webpack_require__(3639);
// Currently in sync with Node.js lib/assert.js
// https://github.com/nodejs/node/commit/2a51ae424a513ec9a6aa3466baa0cc1d55dd4f3b
// Originally from narwhal.js (http://narwhaljs.org)
// Copyright (c) 2009 Thomas Robinson <280north.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the 'Software'), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


function _typeof(obj) {
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof = function _typeof(obj) {
      return typeof obj;
    };
  } else {
    _typeof = function _typeof(obj) {
      return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    };
  }
  return _typeof(obj);
}
function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
var _require = __webpack_require__(4393),
  _require$codes = _require.codes,
  ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT,
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
  ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE,
  ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE,
  ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;
var AssertionError = __webpack_require__(4015);
var _require2 = __webpack_require__(4485),
  inspect = _require2.inspect;
var _require$types = (__webpack_require__(4485).types),
  isPromise = _require$types.isPromise,
  isRegExp = _require$types.isRegExp;
var objectAssign = Object.assign ? Object.assign : (__webpack_require__(5114).assign);
var objectIs = Object.is ? Object.is : __webpack_require__(8339);
var errorCache = new Map();
var isDeepEqual;
var isDeepStrictEqual;
var parseExpressionAt;
var findNodeAround;
var decoder;
function lazyLoadComparison() {
  var comparison = __webpack_require__(7959);
  isDeepEqual = comparison.isDeepEqual;
  isDeepStrictEqual = comparison.isDeepStrictEqual;
} // Escape control characters but not \n and \t to keep the line breaks and
// indentation intact.
// eslint-disable-next-line no-control-regex

var escapeSequencesRegExp = /[\x00-\x08\x0b\x0c\x0e-\x1f]/g;
var meta = (/* unused pure expression or super */ null && (["\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005", "\\u0006", "\\u0007", '\\b', '', '', "\\u000b", '\\f', '', "\\u000e", "\\u000f", "\\u0010", "\\u0011", "\\u0012", "\\u0013", "\\u0014", "\\u0015", "\\u0016", "\\u0017", "\\u0018", "\\u0019", "\\u001a", "\\u001b", "\\u001c", "\\u001d", "\\u001e", "\\u001f"]));
var escapeFn = function escapeFn(str) {
  return meta[str.charCodeAt(0)];
};
var warned = false; // The assert module provides functions that throw
// AssertionError's when particular conditions are not met. The
// assert module must conform to the following interface.

var assert = module.exports = ok;
var NO_EXCEPTION_SENTINEL = {}; // All of the following functions must throw an AssertionError
// when a corresponding condition is not met, with a message that
// may be undefined if not provided. All assertion methods provide
// both the actual and expected values to the assertion error for
// display purposes.

function innerFail(obj) {
  if (obj.message instanceof Error) throw obj.message;
  throw new AssertionError(obj);
}
function fail(actual, expected, message, operator, stackStartFn) {
  var argsLen = arguments.length;
  var internalMessage;
  if (argsLen === 0) {
    internalMessage = 'Failed';
  } else if (argsLen === 1) {
    message = actual;
    actual = undefined;
  } else {
    if (warned === false) {
      warned = true;
      var warn = process.emitWarning ? process.emitWarning : console.warn.bind(console);
      warn('assert.fail() with more than one argument is deprecated. ' + 'Please use assert.strictEqual() instead or only pass a message.', 'DeprecationWarning', 'DEP0094');
    }
    if (argsLen === 2) operator = '!=';
  }
  if (message instanceof Error) throw message;
  var errArgs = {
    actual: actual,
    expected: expected,
    operator: operator === undefined ? 'fail' : operator,
    stackStartFn: stackStartFn || fail
  };
  if (message !== undefined) {
    errArgs.message = message;
  }
  var err = new AssertionError(errArgs);
  if (internalMessage) {
    err.message = internalMessage;
    err.generatedMessage = true;
  }
  throw err;
}
assert.fail = fail; // The AssertionError is defined in internal/error.

assert.AssertionError = AssertionError;
function innerOk(fn, argLen, value, message) {
  if (!value) {
    var generatedMessage = false;
    if (argLen === 0) {
      generatedMessage = true;
      message = 'No value argument passed to `assert.ok()`';
    } else if (message instanceof Error) {
      throw message;
    }
    var err = new AssertionError({
      actual: value,
      expected: true,
      message: message,
      operator: '==',
      stackStartFn: fn
    });
    err.generatedMessage = generatedMessage;
    throw err;
  }
} // Pure assertion tests whether a value is truthy, as determined
// by !!value.

function ok() {
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
    args[_key] = arguments[_key];
  }
  innerOk.apply(void 0, [ok, args.length].concat(args));
}
assert.ok = ok; // The equality assertion tests shallow, coercive equality with ==.

/* eslint-disable no-restricted-properties */

assert.equal = function equal(actual, expected, message) {
  if (arguments.length < 2) {
    throw new ERR_MISSING_ARGS('actual', 'expected');
  } // eslint-disable-next-line eqeqeq

  if (actual != expected) {
    innerFail({
      actual: actual,
      expected: expected,
      message: message,
      operator: '==',
      stackStartFn: equal
    });
  }
}; // The non-equality assertion tests for whether two objects are not
// equal with !=.

assert.notEqual = function notEqual(actual, expected, message) {
  if (arguments.length < 2) {
    throw new ERR_MISSING_ARGS('actual', 'expected');
  } // eslint-disable-next-line eqeqeq

  if (actual == expected) {
    innerFail({
      actual: actual,
      expected: expected,
      message: message,
      operator: '!=',
      stackStartFn: notEqual
    });
  }
}; // The equivalence assertion tests a deep equality relation.

assert.deepEqual = function deepEqual(actual, expected, message) {
  if (arguments.length < 2) {
    throw new ERR_MISSING_ARGS('actual', 'expected');
  }
  if (isDeepEqual === undefined) lazyLoadComparison();
  if (!isDeepEqual(actual, expected)) {
    innerFail({
      actual: actual,
      expected: expected,
      message: message,
      operator: 'deepEqual',
      stackStartFn: deepEqual
    });
  }
}; // The non-equivalence assertion tests for any deep inequality.

assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
  if (arguments.length < 2) {
    throw new ERR_MISSING_ARGS('actual', 'expected');
  }
  if (isDeepEqual === undefined) lazyLoadComparison();
  if (isDeepEqual(actual, expected)) {
    innerFail({
      actual: actual,
      expected: expected,
      message: message,
      operator: 'notDeepEqual',
      stackStartFn: notDeepEqual
    });
  }
};
/* eslint-enable */

assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
  if (arguments.length < 2) {
    throw new ERR_MISSING_ARGS('actual', 'expected');
  }
  if (isDeepEqual === undefined) lazyLoadComparison();
  if (!isDeepStrictEqual(actual, expected)) {
    innerFail({
      actual: actual,
      expected: expected,
      message: message,
      operator: 'deepStrictEqual',
      stackStartFn: deepStrictEqual
    });
  }
};
assert.notDeepStrictEqual = notDeepStrictEqual;
function notDeepStrictEqual(actual, expected, message) {
  if (arguments.length < 2) {
    throw new ERR_MISSING_ARGS('actual', 'expected');
  }
  if (isDeepEqual === undefined) lazyLoadComparison();
  if (isDeepStrictEqual(actual, expected)) {
    innerFail({
      actual: actual,
      expected: expected,
      message: message,
      operator: 'notDeepStrictEqual',
      stackStartFn: notDeepStrictEqual
    });
  }
}
assert.strictEqual = function strictEqual(actual, expected, message) {
  if (arguments.length < 2) {
    throw new ERR_MISSING_ARGS('actual', 'expected');
  }
  if (!objectIs(actual, expected)) {
    innerFail({
      actual: actual,
      expected: expected,
      message: message,
      operator: 'strictEqual',
      stackStartFn: strictEqual
    });
  }
};
assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
  if (arguments.length < 2) {
    throw new ERR_MISSING_ARGS('actual', 'expected');
  }
  if (objectIs(actual, expected)) {
    innerFail({
      actual: actual,
      expected: expected,
      message: message,
      operator: 'notStrictEqual',
      stackStartFn: notStrictEqual
    });
  }
};
var Comparison = function Comparison(obj, keys, actual) {
  var _this = this;
  _classCallCheck(this, Comparison);
  keys.forEach(function (key) {
    if (key in obj) {
      if (actual !== undefined && typeof actual[key] === 'string' && isRegExp(obj[key]) && obj[key].test(actual[key])) {
        _this[key] = actual[key];
      } else {
        _this[key] = obj[key];
      }
    }
  });
};
function compareExceptionKey(actual, expected, key, message, keys, fn) {
  if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) {
    if (!message) {
      // Create placeholder objects to create a nice output.
      var a = new Comparison(actual, keys);
      var b = new Comparison(expected, keys, actual);
      var err = new AssertionError({
        actual: a,
        expected: b,
        operator: 'deepStrictEqual',
        stackStartFn: fn
      });
      err.actual = actual;
      err.expected = expected;
      err.operator = fn.name;
      throw err;
    }
    innerFail({
      actual: actual,
      expected: expected,
      message: message,
      operator: fn.name,
      stackStartFn: fn
    });
  }
}
function expectedException(actual, expected, msg, fn) {
  if (typeof expected !== 'function') {
    if (isRegExp(expected)) return expected.test(actual); // assert.doesNotThrow does not accept objects.

    if (arguments.length === 2) {
      throw new ERR_INVALID_ARG_TYPE('expected', ['Function', 'RegExp'], expected);
    } // Handle primitives properly.

    if (_typeof(actual) !== 'object' || actual === null) {
      var err = new AssertionError({
        actual: actual,
        expected: expected,
        message: msg,
        operator: 'deepStrictEqual',
        stackStartFn: fn
      });
      err.operator = fn.name;
      throw err;
    }
    var keys = Object.keys(expected); // Special handle errors to make sure the name and the message are compared
    // as well.

    if (expected instanceof Error) {
      keys.push('name', 'message');
    } else if (keys.length === 0) {
      throw new ERR_INVALID_ARG_VALUE('error', expected, 'may not be an empty object');
    }
    if (isDeepEqual === undefined) lazyLoadComparison();
    keys.forEach(function (key) {
      if (typeof actual[key] === 'string' && isRegExp(expected[key]) && expected[key].test(actual[key])) {
        return;
      }
      compareExceptionKey(actual, expected, key, msg, keys, fn);
    });
    return true;
  } // Guard instanceof against arrow functions as they don't have a prototype.

  if (expected.prototype !== undefined && actual instanceof expected) {
    return true;
  }
  if (Error.isPrototypeOf(expected)) {
    return false;
  }
  return expected.call({}, actual) === true;
}
function getActual(fn) {
  if (typeof fn !== 'function') {
    throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn);
  }
  try {
    fn();
  } catch (e) {
    return e;
  }
  return NO_EXCEPTION_SENTINEL;
}
function checkIsPromise(obj) {
  // Accept native ES6 promises and promises that are implemented in a similar
  // way. Do not accept thenables that use a function as `obj` and that have no
  // `catch` handler.
  // TODO: thenables are checked up until they have the correct methods,
  // but according to documentation, the `then` method should receive
  // the `fulfill` and `reject` arguments as well or it may be never resolved.
  return isPromise(obj) || obj !== null && _typeof(obj) === 'object' && typeof obj.then === 'function' && typeof obj.catch === 'function';
}
function waitForActual(promiseFn) {
  return Promise.resolve().then(function () {
    var resultPromise;
    if (typeof promiseFn === 'function') {
      // Return a rejected promise if `promiseFn` throws synchronously.
      resultPromise = promiseFn(); // Fail in case no promise is returned.

      if (!checkIsPromise(resultPromise)) {
        throw new ERR_INVALID_RETURN_VALUE('instance of Promise', 'promiseFn', resultPromise);
      }
    } else if (checkIsPromise(promiseFn)) {
      resultPromise = promiseFn;
    } else {
      throw new ERR_INVALID_ARG_TYPE('promiseFn', ['Function', 'Promise'], promiseFn);
    }
    return Promise.resolve().then(function () {
      return resultPromise;
    }).then(function () {
      return NO_EXCEPTION_SENTINEL;
    }).catch(function (e) {
      return e;
    });
  });
}
function expectsError(stackStartFn, actual, error, message) {
  if (typeof error === 'string') {
    if (arguments.length === 4) {
      throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);
    }
    if (_typeof(actual) === 'object' && actual !== null) {
      if (actual.message === error) {
        throw new ERR_AMBIGUOUS_ARGUMENT('error/message', "The error message \"".concat(actual.message, "\" is identical to the message."));
      }
    } else if (actual === error) {
      throw new ERR_AMBIGUOUS_ARGUMENT('error/message', "The error \"".concat(actual, "\" is identical to the message."));
    }
    message = error;
    error = undefined;
  } else if (error != null && _typeof(error) !== 'object' && typeof error !== 'function') {
    throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);
  }
  if (actual === NO_EXCEPTION_SENTINEL) {
    var details = '';
    if (error && error.name) {
      details += " (".concat(error.name, ")");
    }
    details += message ? ": ".concat(message) : '.';
    var fnType = stackStartFn.name === 'rejects' ? 'rejection' : 'exception';
    innerFail({
      actual: undefined,
      expected: error,
      operator: stackStartFn.name,
      message: "Missing expected ".concat(fnType).concat(details),
      stackStartFn: stackStartFn
    });
  }
  if (error && !expectedException(actual, error, message, stackStartFn)) {
    throw actual;
  }
}
function expectsNoError(stackStartFn, actual, error, message) {
  if (actual === NO_EXCEPTION_SENTINEL) return;
  if (typeof error === 'string') {
    message = error;
    error = undefined;
  }
  if (!error || expectedException(actual, error)) {
    var details = message ? ": ".concat(message) : '.';
    var fnType = stackStartFn.name === 'doesNotReject' ? 'rejection' : 'exception';
    innerFail({
      actual: actual,
      expected: error,
      operator: stackStartFn.name,
      message: "Got unwanted ".concat(fnType).concat(details, "\n") + "Actual message: \"".concat(actual && actual.message, "\""),
      stackStartFn: stackStartFn
    });
  }
  throw actual;
}
assert.throws = function throws(promiseFn) {
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
    args[_key2 - 1] = arguments[_key2];
  }
  expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args));
};
assert.rejects = function rejects(promiseFn) {
  for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
    args[_key3 - 1] = arguments[_key3];
  }
  return waitForActual(promiseFn).then(function (result) {
    return expectsError.apply(void 0, [rejects, result].concat(args));
  });
};
assert.doesNotThrow = function doesNotThrow(fn) {
  for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
    args[_key4 - 1] = arguments[_key4];
  }
  expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args));
};
assert.doesNotReject = function doesNotReject(fn) {
  for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
    args[_key5 - 1] = arguments[_key5];
  }
  return waitForActual(fn).then(function (result) {
    return expectsNoError.apply(void 0, [doesNotReject, result].concat(args));
  });
};
assert.ifError = function ifError(err) {
  if (err !== null && err !== undefined) {
    var message = 'ifError got unwanted exception: ';
    if (_typeof(err) === 'object' && typeof err.message === 'string') {
      if (err.message.length === 0 && err.constructor) {
        message += err.constructor.name;
      } else {
        message += err.message;
      }
    } else {
      message += inspect(err);
    }
    var newErr = new AssertionError({
      actual: err,
      expected: null,
      operator: 'ifError',
      message: message,
      stackStartFn: ifError
    }); // Make sure we actually have a stack trace!

    var origStack = err.stack;
    if (typeof origStack === 'string') {
      // This will remove any duplicated frames from the error frames taken
      // from within `ifError` and add the original error frames to the newly
      // created ones.
      var tmp2 = origStack.split('\n');
      tmp2.shift(); // Filter all frames existing in err.stack.

      var tmp1 = newErr.stack.split('\n');
      for (var i = 0; i < tmp2.length; i++) {
        // Find the first occurrence of the frame.
        var pos = tmp1.indexOf(tmp2[i]);
        if (pos !== -1) {
          // Only keep new frames.
          tmp1 = tmp1.slice(0, pos);
          break;
        }
      }
      newErr.stack = "".concat(tmp1.join('\n'), "\n").concat(tmp2.join('\n'));
    }
    throw newErr;
  }
}; // Expose a strict only variant of assert

function strict() {
  for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
    args[_key6] = arguments[_key6];
  }
  innerOk.apply(void 0, [strict, args.length].concat(args));
}
assert.strict = objectAssign(strict, assert, {
  equal: assert.strictEqual,
  deepEqual: assert.deepStrictEqual,
  notEqual: assert.notStrictEqual,
  notDeepEqual: assert.notDeepStrictEqual
});
assert.strict.strict = assert.strict;

/***/ }),

/***/ 4015:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";
/* provided dependency */ var process = __webpack_require__(8924);
// Currently in sync with Node.js lib/internal/assert/assertion_error.js
// https://github.com/nodejs/node/commit/0817840f775032169ddd70c85ac059f18ffcc81c


function _objectSpread(target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i] != null ? arguments[i] : {};
    var ownKeys = Object.keys(source);
    if (typeof Object.getOwnPropertySymbols === 'function') {
      ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
        return Object.getOwnPropertyDescriptor(source, sym).enumerable;
      }));
    }
    ownKeys.forEach(function (key) {
      _defineProperty(target, key, source[key]);
    });
  }
  return target;
}
function _defineProperty(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, {
      value: value,
      enumerable: true,
      configurable: true,
      writable: true
    });
  } else {
    obj[key] = value;
  }
  return obj;
}
function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties(target, props) {
  for (var i = 0; i < props.length; i++) {
    var descriptor = props[i];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor) descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass(Constructor, protoProps, staticProps) {
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  if (staticProps) _defineProperties(Constructor, staticProps);
  return Constructor;
}
function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized(self);
}
function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self;
}
function _inherits(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, {
    constructor: {
      value: subClass,
      writable: true,
      configurable: true
    }
  });
  if (superClass) _setPrototypeOf(subClass, superClass);
}
function _wrapNativeSuper(Class) {
  var _cache = typeof Map === "function" ? new Map() : undefined;
  _wrapNativeSuper = function _wrapNativeSuper(Class) {
    if (Class === null || !_isNativeFunction(Class)) return Class;
    if (typeof Class !== "function") {
      throw new TypeError("Super expression must either be null or a function");
    }
    if (typeof _cache !== "undefined") {
      if (_cache.has(Class)) return _cache.get(Class);
      _cache.set(Class, Wrapper);
    }
    function Wrapper() {
      return _construct(Class, arguments, _getPrototypeOf(this).constructor);
    }
    Wrapper.prototype = Object.create(Class.prototype, {
      constructor: {
        value: Wrapper,
        enumerable: false,
        writable: true,
        configurable: true
      }
    });
    return _setPrototypeOf(Wrapper, Class);
  };
  return _wrapNativeSuper(Class);
}
function isNativeReflectConstruct() {
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  if (Reflect.construct.sham) return false;
  if (typeof Proxy === "function") return true;
  try {
    Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
    return true;
  } catch (e) {
    return false;
  }
}
function _construct(Parent, args, Class) {
  if (isNativeReflectConstruct()) {
    _construct = Reflect.construct;
  } else {
    _construct = function _construct(Parent, args, Class) {
      var a = [null];
      a.push.apply(a, args);
      var Constructor = Function.bind.apply(Parent, a);
      var instance = new Constructor();
      if (Class) _setPrototypeOf(instance, Class.prototype);
      return instance;
    };
  }
  return _construct.apply(null, arguments);
}
function _isNativeFunction(fn) {
  return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };
  return _setPrototypeOf(o, p);
}
function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}
function _typeof(obj) {
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof = function _typeof(obj) {
      return typeof obj;
    };
  } else {
    _typeof = function _typeof(obj) {
      return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    };
  }
  return _typeof(obj);
}
var _require = __webpack_require__(4485),
  inspect = _require.inspect;
var _require2 = __webpack_require__(4393),
  ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith

function endsWith(str, search, this_len) {
  if (this_len === undefined || this_len > str.length) {
    this_len = str.length;
  }
  return str.substring(this_len - search.length, this_len) === search;
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat

function repeat(str, count) {
  count = Math.floor(count);
  if (str.length == 0 || count == 0) return '';
  var maxCount = str.length * count;
  count = Math.floor(Math.log(count) / Math.log(2));
  while (count) {
    str += str;
    count--;
  }
  str += str.substring(0, maxCount - str.length);
  return str;
}
var blue = '';
var green = '';
var red = '';
var white = '';
var kReadableOperator = {
  deepStrictEqual: 'Expected values to be strictly deep-equal:',
  strictEqual: 'Expected values to be strictly equal:',
  strictEqualObject: 'Expected "actual" to be reference-equal to "expected":',
  deepEqual: 'Expected values to be loosely deep-equal:',
  equal: 'Expected values to be loosely equal:',
  notDeepStrictEqual: 'Expected "actual" not to be strictly deep-equal to:',
  notStrictEqual: 'Expected "actual" to be strictly unequal to:',
  notStrictEqualObject: 'Expected "actual" not to be reference-equal to "expected":',
  notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:',
  notEqual: 'Expected "actual" to be loosely unequal to:',
  notIdentical: 'Values identical but not reference-equal:'
}; // Comparing short primitives should just show === / !== instead of using the
// diff.

var kMaxShortLength = 10;
function copyError(source) {
  var keys = Object.keys(source);
  var target = Object.create(Object.getPrototypeOf(source));
  keys.forEach(function (key) {
    target[key] = source[key];
  });
  Object.defineProperty(target, 'message', {
    value: source.message
  });
  return target;
}
function inspectValue(val) {
  // The util.inspect default values could be changed. This makes sure the
  // error messages contain the necessary information nevertheless.
  return inspect(val, {
    compact: false,
    customInspect: false,
    depth: 1000,
    maxArrayLength: Infinity,
    // Assert compares only enumerable properties (with a few exceptions).
    showHidden: false,
    // Having a long line as error is better than wrapping the line for
    // comparison for now.
    // TODO(BridgeAR): `breakLength` should be limited as soon as soon as we
    // have meta information about the inspected properties (i.e., know where
    // in what line the property starts and ends).
    breakLength: Infinity,
    // Assert does not detect proxies currently.
    showProxy: false,
    sorted: true,
    // Inspect getters as we also check them when comparing entries.
    getters: true
  });
}
function createErrDiff(actual, expected, operator) {
  var other = '';
  var res = '';
  var lastPos = 0;
  var end = '';
  var skipped = false;
  var actualInspected = inspectValue(actual);
  var actualLines = actualInspected.split('\n');
  var expectedLines = inspectValue(expected).split('\n');
  var i = 0;
  var indicator = ''; // In case both values are objects explicitly mark them as not reference equal
  // for the `strictEqual` operator.

  if (operator === 'strictEqual' && _typeof(actual) === 'object' && _typeof(expected) === 'object' && actual !== null && expected !== null) {
    operator = 'strictEqualObject';
  } // If "actual" and "expected" fit on a single line and they are not strictly
  // equal, check further special handling.

  if (actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) {
    var inputLength = actualLines[0].length + expectedLines[0].length; // If the character length of "actual" and "expected" together is less than
    // kMaxShortLength and if neither is an object and at least one of them is
    // not `zero`, use the strict equal comparison to visualize the output.

    if (inputLength <= kMaxShortLength) {
      if ((_typeof(actual) !== 'object' || actual === null) && (_typeof(expected) !== 'object' || expected === null) && (actual !== 0 || expected !== 0)) {
        // -0 === +0
        return "".concat(kReadableOperator[operator], "\n\n") + "".concat(actualLines[0], " !== ").concat(expectedLines[0], "\n");
      }
    } else if (operator !== 'strictEqualObject') {
      // If the stderr is a tty and the input length is lower than the current
      // columns per line, add a mismatch indicator below the output. If it is
      // not a tty, use a default value of 80 characters.
      var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80;
      if (inputLength < maxLength) {
        while (actualLines[0][i] === expectedLines[0][i]) {
          i++;
        } // Ignore the first characters.

        if (i > 2) {
          // Add position indicator for the first mismatch in case it is a
          // single line and the input length is less than the column length.
          indicator = "\n  ".concat(repeat(' ', i), "^");
          i = 0;
        }
      }
    }
  } // Remove all ending lines that match (this optimizes the output for
  // readability by reducing the number of total changed lines).

  var a = actualLines[actualLines.length - 1];
  var b = expectedLines[expectedLines.length - 1];
  while (a === b) {
    if (i++ < 2) {
      end = "\n  ".concat(a).concat(end);
    } else {
      other = a;
    }
    actualLines.pop();
    expectedLines.pop();
    if (actualLines.length === 0 || expectedLines.length === 0) break;
    a = actualLines[actualLines.length - 1];
    b = expectedLines[expectedLines.length - 1];
  }
  var maxLines = Math.max(actualLines.length, expectedLines.length); // Strict equal with identical objects that are not identical by reference.
  // E.g., assert.deepStrictEqual({ a: Symbol() }, { a: Symbol() })

  if (maxLines === 0) {
    // We have to get the result again. The lines were all removed before.
    var _actualLines = actualInspected.split('\n'); // Only remove lines in case it makes sense to collapse those.
    // TODO: Accept env to always show the full error.

    if (_actualLines.length > 30) {
      _actualLines[26] = "".concat(blue, "...").concat(white);
      while (_actualLines.length > 27) {
        _actualLines.pop();
      }
    }
    return "".concat(kReadableOperator.notIdentical, "\n\n").concat(_actualLines.join('\n'), "\n");
  }
  if (i > 3) {
    end = "\n".concat(blue, "...").concat(white).concat(end);
    skipped = true;
  }
  if (other !== '') {
    end = "\n  ".concat(other).concat(end);
    other = '';
  }
  var printedLines = 0;
  var msg = kReadableOperator[operator] + "\n".concat(green, "+ actual").concat(white, " ").concat(red, "- expected").concat(white);
  var skippedMsg = " ".concat(blue, "...").concat(white, " Lines skipped");
  for (i = 0; i < maxLines; i++) {
    // Only extra expected lines exist
    var cur = i - lastPos;
    if (actualLines.length < i + 1) {
      // If the last diverging line is more than one line above and the
      // current line is at least line three, add some of the former lines and
      // also add dots to indicate skipped entries.
      if (cur > 1 && i > 2) {
        if (cur > 4) {
          res += "\n".concat(blue, "...").concat(white);
          skipped = true;
        } else if (cur > 3) {
          res += "\n  ".concat(expectedLines[i - 2]);
          printedLines++;
        }
        res += "\n  ".concat(expectedLines[i - 1]);
        printedLines++;
      } // Mark the current line as the last diverging one.

      lastPos = i; // Add the expected line to the cache.

      other += "\n".concat(red, "-").concat(white, " ").concat(expectedLines[i]);
      printedLines++; // Only extra actual lines exist
    } else if (expectedLines.length < i + 1) {
      // If the last diverging line is more than one line above and the
      // current line is at least line three, add some of the former lines and
      // also add dots to indicate skipped entries.
      if (cur > 1 && i > 2) {
        if (cur > 4) {
          res += "\n".concat(blue, "...").concat(white);
          skipped = true;
        } else if (cur > 3) {
          res += "\n  ".concat(actualLines[i - 2]);
          printedLines++;
        }
        res += "\n  ".concat(actualLines[i - 1]);
        printedLines++;
      } // Mark the current line as the last diverging one.

      lastPos = i; // Add the actual line to the result.

      res += "\n".concat(green, "+").concat(white, " ").concat(actualLines[i]);
      printedLines++; // Lines diverge
    } else {
      var expectedLine = expectedLines[i];
      var actualLine = actualLines[i]; // If the lines diverge, specifically check for lines that only diverge by
      // a trailing comma. In that case it is actually identical and we should
      // mark it as such.

      var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, ',') || actualLine.slice(0, -1) !== expectedLine); // If the expected line has a trailing comma but is otherwise identical,
      // add a comma at the end of the actual line. Otherwise the output could
      // look weird as in:
      //
      //   [
      //     1         // No comma at the end!
      // +   2
      //   ]
      //

      if (divergingLines && endsWith(expectedLine, ',') && expectedLine.slice(0, -1) === actualLine) {
        divergingLines = false;
        actualLine += ',';
      }
      if (divergingLines) {
        // If the last diverging line is more than one line above and the
        // current line is at least line three, add some of the former lines and
        // also add dots to indicate skipped entries.
        if (cur > 1 && i > 2) {
          if (cur > 4) {
            res += "\n".concat(blue, "...").concat(white);
            skipped = true;
          } else if (cur > 3) {
            res += "\n  ".concat(actualLines[i - 2]);
            printedLines++;
          }
          res += "\n  ".concat(actualLines[i - 1]);
          printedLines++;
        } // Mark the current line as the last diverging one.

        lastPos = i; // Add the actual line to the result and cache the expected diverging
        // line so consecutive diverging lines show up as +++--- and not +-+-+-.

        res += "\n".concat(green, "+").concat(white, " ").concat(actualLine);
        other += "\n".concat(red, "-").concat(white, " ").concat(expectedLine);
        printedLines += 2; // Lines are identical
      } else {
        // Add all cached information to the result before adding other things
        // and reset the cache.
        res += other;
        other = ''; // If the last diverging line is exactly one line above or if it is the
        // very first line, add the line to the result.

        if (cur === 1 || i === 0) {
          res += "\n  ".concat(actualLine);
          printedLines++;
        }
      }
    } // Inspected object to big (Show ~20 rows max)

    if (printedLines > 20 && i < maxLines - 2) {
      return "".concat(msg).concat(skippedMsg, "\n").concat(res, "\n").concat(blue, "...").concat(white).concat(other, "\n") + "".concat(blue, "...").concat(white);
    }
  }
  return "".concat(msg).concat(skipped ? skippedMsg : '', "\n").concat(res).concat(other).concat(end).concat(indicator);
}
var AssertionError = /*#__PURE__*/
function (_Error) {
  _inherits(AssertionError, _Error);
  function AssertionError(options) {
    var _this;
    _classCallCheck(this, AssertionError);
    if (_typeof(options) !== 'object' || options === null) {
      throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
    }
    var message = options.message,
      operator = options.operator,
      stackStartFn = options.stackStartFn;
    var actual = options.actual,
      expected = options.expected;
    var limit = Error.stackTraceLimit;
    Error.stackTraceLimit = 0;
    if (message != null) {
      _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, String(message)));
    } else {
      if (process.stderr && process.stderr.isTTY) {
        // Reset on each call to make sure we handle dynamically set environment
        // variables correct.
        if (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1) {
          blue = "\x1B[34m";
          green = "\x1B[32m";
          white = "\x1B[39m";
          red = "\x1B[31m";
        } else {
          blue = '';
          green = '';
          white = '';
          red = '';
        }
      } // Prevent the error stack from being visible by duplicating the error
      // in a very close way to the original in case both sides are actually
      // instances of Error.

      if (_typeof(actual) === 'object' && actual !== null && _typeof(expected) === 'object' && expected !== null && 'stack' in actual && actual instanceof Error && 'stack' in expected && expected instanceof Error) {
        actual = copyError(actual);
        expected = copyError(expected);
      }
      if (operator === 'deepStrictEqual' || operator === 'strictEqual') {
        _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, createErrDiff(actual, expected, operator)));
      } else if (operator === 'notDeepStrictEqual' || operator === 'notStrictEqual') {
        // In case the objects are equal but the operator requires unequal, show
        // the first object and say A equals B
        var base = kReadableOperator[operator];
        var res = inspectValue(actual).split('\n'); // In case "actual" is an object, it should not be reference equal.

        if (operator === 'notStrictEqual' && _typeof(actual) === 'object' && actual !== null) {
          base = kReadableOperator.notStrictEqualObject;
        } // Only remove lines in case it makes sense to collapse those.
        // TODO: Accept env to always show the full error.

        if (res.length > 30) {
          res[26] = "".concat(blue, "...").concat(white);
          while (res.length > 27) {
            res.pop();
          }
        } // Only print a single input.

        if (res.length === 1) {
          _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(base, " ").concat(res[0])));
        } else {
          _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(base, "\n\n").concat(res.join('\n'), "\n")));
        }
      } else {
        var _res = inspectValue(actual);
        var other = '';
        var knownOperators = kReadableOperator[operator];
        if (operator === 'notDeepEqual' || operator === 'notEqual') {
          _res = "".concat(kReadableOperator[operator], "\n\n").concat(_res);
          if (_res.length > 1024) {
            _res = "".concat(_res.slice(0, 1021), "...");
          }
        } else {
          other = "".concat(inspectValue(expected));
          if (_res.length > 512) {
            _res = "".concat(_res.slice(0, 509), "...");
          }
          if (other.length > 512) {
            other = "".concat(other.slice(0, 509), "...");
          }
          if (operator === 'deepEqual' || operator === 'equal') {
            _res = "".concat(knownOperators, "\n\n").concat(_res, "\n\nshould equal\n\n");
          } else {
            other = " ".concat(operator, " ").concat(other);
          }
        }
        _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(_res).concat(other)));
      }
    }
    Error.stackTraceLimit = limit;
    _this.generatedMessage = !message;
    Object.defineProperty(_assertThisInitialized(_this), 'name', {
      value: 'AssertionError [ERR_ASSERTION]',
      enumerable: false,
      writable: true,
      configurable: true
    });
    _this.code = 'ERR_ASSERTION';
    _this.actual = actual;
    _this.expected = expected;
    _this.operator = operator;
    if (Error.captureStackTrace) {
      // eslint-disable-next-line no-restricted-syntax
      Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn);
    } // Create error message including the error code in the name.

    _this.stack; // Reset the name.

    _this.name = 'AssertionError';
    return _possibleConstructorReturn(_this);
  }
  _createClass(AssertionError, [{
    key: "toString",
    value: function toString() {
      return "".concat(this.name, " [").concat(this.code, "]: ").concat(this.message);
    }
  }, {
    key: inspect.custom,
    value: function value(recurseTimes, ctx) {
      // This limits the `actual` and `expected` property default inspection to
      // the minimum depth. Otherwise those values would be too verbose compared
      // to the actual error message which contains a combined view of these two
      // input values.
      return inspect(this, _objectSpread({}, ctx, {
        customInspect: false,
        depth: 0
      }));
    }
  }]);
  return AssertionError;
}(_wrapNativeSuper(Error));
module.exports = AssertionError;

/***/ }),

/***/ 4393:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";
// Currently in sync with Node.js lib/internal/errors.js
// https://github.com/nodejs/node/commit/3b044962c48fe313905877a96b5d0894a5404f6f

/* eslint node-core/documented-errors: "error" */

/* eslint node-core/alphabetize-errors: "error" */

/* eslint node-core/prefer-util-format-errors: "error" */


// The whole point behind this internal module is to allow Node.js to no
// longer be forced to treat every error message change as a semver-major
// change. The NodeError classes here all expose a `code` property whose
// value statically and permanently identifies the error. While the error
// message may change, the code should not.
function _typeof(obj) {
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof = function _typeof(obj) {
      return typeof obj;
    };
  } else {
    _typeof = function _typeof(obj) {
      return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    };
  }
  return _typeof(obj);
}
function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized(self);
}
function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self;
}
function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}
function _inherits(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, {
    constructor: {
      value: subClass,
      writable: true,
      configurable: true
    }
  });
  if (superClass) _setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };
  return _setPrototypeOf(o, p);
}
var codes = {}; // Lazy loaded

var assert;
var util;
function createErrorType(code, message, Base) {
  if (!Base) {
    Base = Error;
  }
  function getMessage(arg1, arg2, arg3) {
    if (typeof message === 'string') {
      return message;
    } else {
      return message(arg1, arg2, arg3);
    }
  }
  var NodeError = /*#__PURE__*/
  function (_Base) {
    _inherits(NodeError, _Base);
    function NodeError(arg1, arg2, arg3) {
      var _this;
      _classCallCheck(this, NodeError);
      _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError).call(this, getMessage(arg1, arg2, arg3)));
      _this.code = code;
      return _this;
    }
    return NodeError;
  }(Base);
  codes[code] = NodeError;
} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js

function oneOf(expected, thing) {
  if (Array.isArray(expected)) {
    var len = expected.length;
    expected = expected.map(function (i) {
      return String(i);
    });
    if (len > 2) {
      return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1];
    } else if (len === 2) {
      return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
    } else {
      return "of ".concat(thing, " ").concat(expected[0]);
    }
  } else {
    return "of ".concat(thing, " ").concat(String(expected));
  }
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith

function startsWith(str, search, pos) {
  return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith

function endsWith(str, search, this_len) {
  if (this_len === undefined || this_len > str.length) {
    this_len = str.length;
  }
  return str.substring(this_len - search.length, this_len) === search;
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes

function includes(str, search, start) {
  if (typeof start !== 'number') {
    start = 0;
  }
  if (start + search.length > str.length) {
    return false;
  } else {
    return str.indexOf(search, start) !== -1;
  }
}
createErrorType('ERR_AMBIGUOUS_ARGUMENT', 'The "%s" argument is ambiguous. %s', TypeError);
createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
  if (assert === undefined) assert = __webpack_require__(4725);
  assert(typeof name === 'string', "'name' must be a string"); // determiner: 'must be' or 'must not be'

  var determiner;
  if (typeof expected === 'string' && startsWith(expected, 'not ')) {
    determiner = 'must not be';
    expected = expected.replace(/^not /, '');
  } else {
    determiner = 'must be';
  }
  var msg;
  if (endsWith(name, ' argument')) {
    // For cases like 'first argument'
    msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
  } else {
    var type = includes(name, '.') ? 'property' : 'argument';
    msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
  } // TODO(BridgeAR): Improve the output by showing `null` and similar.

  msg += ". Received type ".concat(_typeof(actual));
  return msg;
}, TypeError);
createErrorType('ERR_INVALID_ARG_VALUE', function (name, value) {
  var reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'is invalid';
  if (util === undefined) util = __webpack_require__(4485);
  var inspected = util.inspect(value);
  if (inspected.length > 128) {
    inspected = "".concat(inspected.slice(0, 128), "...");
  }
  return "The argument '".concat(name, "' ").concat(reason, ". Received ").concat(inspected);
}, TypeError, RangeError);
createErrorType('ERR_INVALID_RETURN_VALUE', function (input, name, value) {
  var type;
  if (value && value.constructor && value.constructor.name) {
    type = "instance of ".concat(value.constructor.name);
  } else {
    type = "type ".concat(_typeof(value));
  }
  return "Expected ".concat(input, " to be returned from the \"").concat(name, "\"") + " function but got ".concat(type, ".");
}, TypeError);
createErrorType('ERR_MISSING_ARGS', function () {
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
    args[_key] = arguments[_key];
  }
  if (assert === undefined) assert = __webpack_require__(4725);
  assert(args.length > 0, 'At least one arg needs to be specified');
  var msg = 'The ';
  var len = args.length;
  args = args.map(function (a) {
    return "\"".concat(a, "\"");
  });
  switch (len) {
    case 1:
      msg += "".concat(args[0], " argument");
      break;
    case 2:
      msg += "".concat(args[0], " and ").concat(args[1], " arguments");
      break;
    default:
      msg += args.slice(0, len - 1).join(', ');
      msg += ", and ".concat(args[len - 1], " arguments");
      break;
  }
  return "".concat(msg, " must be specified");
}, TypeError);
module.exports.codes = codes;

/***/ }),

/***/ 7959:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";
// Currently in sync with Node.js lib/internal/util/comparisons.js
// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9


function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}
function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
function _iterableToArrayLimit(arr, i) {
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;
  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
      _arr.push(_s.value);
      if (i && _arr.length === i) break;
    }
  } catch (err) {
    _d = true;
    _e = err;
  } finally {
    try {
      if (!_n && _i["return"] != null) _i["return"]();
    } finally {
      if (_d) throw _e;
    }
  }
  return _arr;
}
function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}
function _typeof(obj) {
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof = function _typeof(obj) {
      return typeof obj;
    };
  } else {
    _typeof = function _typeof(obj) {
      return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    };
  }
  return _typeof(obj);
}
var regexFlagsSupported = /a/g.flags !== undefined;
var arrayFromSet = function arrayFromSet(set) {
  var array = [];
  set.forEach(function (value) {
    return array.push(value);
  });
  return array;
};
var arrayFromMap = function arrayFromMap(map) {
  var array = [];
  map.forEach(function (value, key) {
    return array.push([key, value]);
  });
  return array;
};
var objectIs = Object.is ? Object.is : __webpack_require__(8339);
var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function () {
  return [];
};
var numberIsNaN = Number.isNaN ? Number.isNaN : __webpack_require__(3476);
function uncurryThis(f) {
  return f.call.bind(f);
}
var hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);
var propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable);
var objectToString = uncurryThis(Object.prototype.toString);
var _require$types = (__webpack_require__(4485).types),
  isAnyArrayBuffer = _require$types.isAnyArrayBuffer,
  isArrayBufferView = _require$types.isArrayBufferView,
  isDate = _require$types.isDate,
  isMap = _require$types.isMap,
  isRegExp = _require$types.isRegExp,
  isSet = _require$types.isSet,
  isNativeError = _require$types.isNativeError,
  isBoxedPrimitive = _require$types.isBoxedPrimitive,
  isNumberObject = _require$types.isNumberObject,
  isStringObject = _require$types.isStringObject,
  isBooleanObject = _require$types.isBooleanObject,
  isBigIntObject = _require$types.isBigIntObject,
  isSymbolObject = _require$types.isSymbolObject,
  isFloat32Array = _require$types.isFloat32Array,
  isFloat64Array = _require$types.isFloat64Array;
function isNonIndex(key) {
  if (key.length === 0 || key.length > 10) return true;
  for (var i = 0; i < key.length; i++) {
    var code = key.charCodeAt(i);
    if (code < 48 || code > 57) return true;
  } // The maximum size for an array is 2 ** 32 -1.

  return key.length === 10 && key >= Math.pow(2, 32);
}
function getOwnNonIndexProperties(value) {
  return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value)));
} // Taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
// original notice:

/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
 * @license  MIT
 */

function compare(a, b) {
  if (a === b) {
    return 0;
  }
  var x = a.length;
  var y = b.length;
  for (var i = 0, len = Math.min(x, y); i < len; ++i) {
    if (a[i] !== b[i]) {
      x = a[i];
      y = b[i];
      break;
    }
  }
  if (x < y) {
    return -1;
  }
  if (y < x) {
    return 1;
  }
  return 0;
}
var ONLY_ENUMERABLE = undefined;
var kStrict = true;
var kLoose = false;
var kNoIterator = 0;
var kIsArray = 1;
var kIsSet = 2;
var kIsMap = 3; // Check if they have the same source and flags

function areSimilarRegExps(a, b) {
  return regexFlagsSupported ? a.source === b.source && a.flags === b.flags : RegExp.prototype.toString.call(a) === RegExp.prototype.toString.call(b);
}
function areSimilarFloatArrays(a, b) {
  if (a.byteLength !== b.byteLength) {
    return false;
  }
  for (var offset = 0; offset < a.byteLength; offset++) {
    if (a[offset] !== b[offset]) {
      return false;
    }
  }
  return true;
}
function areSimilarTypedArrays(a, b) {
  if (a.byteLength !== b.byteLength) {
    return false;
  }
  return compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0;
}
function areEqualArrayBuffers(buf1, buf2) {
  return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0;
}
function isEqualBoxedPrimitive(val1, val2) {
  if (isNumberObject(val1)) {
    return isNumberObject(val2) && objectIs(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2));
  }
  if (isStringObject(val1)) {
    return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2);
  }
  if (isBooleanObject(val1)) {
    return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2);
  }
  if (isBigIntObject(val1)) {
    return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2);
  }
  return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2);
} // Notes: Type tags are historical [[Class]] properties that can be set by
// FunctionTemplate::SetClassName() in C++ or Symbol.toStringTag in JS
// and retrieved using Object.prototype.toString.call(obj) in JS
// See https://tc39.github.io/ecma262/#sec-object.prototype.tostring
// for a list of tags pre-defined in the spec.
// There are some unspecified tags in the wild too (e.g. typed array tags).
// Since tags can be altered, they only serve fast failures
//
// Typed arrays and buffers are checked by comparing the content in their
// underlying ArrayBuffer. This optimization requires that it's
// reasonable to interpret their underlying memory in the same way,
// which is checked by comparing their type tags.
// (e.g. a Uint8Array and a Uint16Array with the same memory content
// could still be different because they will be interpreted differently).
//
// For strict comparison, objects should have
// a) The same built-in type tags
// b) The same prototypes.

function innerDeepEqual(val1, val2, strict, memos) {
  // All identical values are equivalent, as determined by ===.
  if (val1 === val2) {
    if (val1 !== 0) return true;
    return strict ? objectIs(val1, val2) : true;
  } // Check more closely if val1 and val2 are equal.

  if (strict) {
    if (_typeof(val1) !== 'object') {
      return typeof val1 === 'number' && numberIsNaN(val1) && numberIsNaN(val2);
    }
    if (_typeof(val2) !== 'object' || val1 === null || val2 === null) {
      return false;
    }
    if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) {
      return false;
    }
  } else {
    if (val1 === null || _typeof(val1) !== 'object') {
      if (val2 === null || _typeof(val2) !== 'object') {
        // eslint-disable-next-line eqeqeq
        return val1 == val2;
      }
      return false;
    }
    if (val2 === null || _typeof(val2) !== 'object') {
      return false;
    }
  }
  var val1Tag = objectToString(val1);
  var val2Tag = objectToString(val2);
  if (val1Tag !== val2Tag) {
    return false;
  }
  if (Array.isArray(val1)) {
    // Check for sparse arrays and general fast path
    if (val1.length !== val2.length) {
      return false;
    }
    var keys1 = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);
    var keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);
    if (keys1.length !== keys2.length) {
      return false;
    }
    return keyCheck(val1, val2, strict, memos, kIsArray, keys1);
  } // [browserify] This triggers on certain types in IE (Map/Set) so we don't
  // wan't to early return out of the rest of the checks. However we can check
  // if the second value is one of these values and the first isn't.

  if (val1Tag === '[object Object]') {
    // return keyCheck(val1, val2, strict, memos, kNoIterator);
    if (!isMap(val1) && isMap(val2) || !isSet(val1) && isSet(val2)) {
      return false;
    }
  }
  if (isDate(val1)) {
    if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) {
      return false;
    }
  } else if (isRegExp(val1)) {
    if (!isRegExp(val2) || !areSimilarRegExps(val1, val2)) {
      return false;
    }
  } else if (isNativeError(val1) || val1 instanceof Error) {
    // Do not compare the stack as it might differ even though the error itself
    // is otherwise identical.
    if (val1.message !== val2.message || val1.name !== val2.name) {
      return false;
    }
  } else if (isArrayBufferView(val1)) {
    if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) {
      if (!areSimilarFloatArrays(val1, val2)) {
        return false;
      }
    } else if (!areSimilarTypedArrays(val1, val2)) {
      return false;
    } // Buffer.compare returns true, so val1.length === val2.length. If they both
    // only contain numeric keys, we don't need to exam further than checking
    // the symbols.

    var _keys = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);
    var _keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);
    if (_keys.length !== _keys2.length) {
      return false;
    }
    return keyCheck(val1, val2, strict, memos, kNoIterator, _keys);
  } else if (isSet(val1)) {
    if (!isSet(val2) || val1.size !== val2.size) {
      return false;
    }
    return keyCheck(val1, val2, strict, memos, kIsSet);
  } else if (isMap(val1)) {
    if (!isMap(val2) || val1.size !== val2.size) {
      return false;
    }
    return keyCheck(val1, val2, strict, memos, kIsMap);
  } else if (isAnyArrayBuffer(val1)) {
    if (!areEqualArrayBuffers(val1, val2)) {
      return false;
    }
  } else if (isBoxedPrimitive(val1) && !isEqualBoxedPrimitive(val1, val2)) {
    return false;
  }
  return keyCheck(val1, val2, strict, memos, kNoIterator);
}
function getEnumerables(val, keys) {
  return keys.filter(function (k) {
    return propertyIsEnumerable(val, k);
  });
}
function keyCheck(val1, val2, strict, memos, iterationType, aKeys) {
  // For all remaining Object pairs, including Array, objects and Maps,
  // equivalence is determined by having:
  // a) The same number of owned enumerable properties
  // b) The same set of keys/indexes (although not necessarily the same order)
  // c) Equivalent values for every corresponding key/index
  // d) For Sets and Maps, equal contents
  // Note: this accounts for both named and indexed properties on Arrays.
  if (arguments.length === 5) {
    aKeys = Object.keys(val1);
    var bKeys = Object.keys(val2); // The pair must have the same number of owned properties.

    if (aKeys.length !== bKeys.length) {
      return false;
    }
  } // Cheap key test

  var i = 0;
  for (; i < aKeys.length; i++) {
    if (!hasOwnProperty(val2, aKeys[i])) {
      return false;
    }
  }
  if (strict && arguments.length === 5) {
    var symbolKeysA = objectGetOwnPropertySymbols(val1);
    if (symbolKeysA.length !== 0) {
      var count = 0;
      for (i = 0; i < symbolKeysA.length; i++) {
        var key = symbolKeysA[i];
        if (propertyIsEnumerable(val1, key)) {
          if (!propertyIsEnumerable(val2, key)) {
            return false;
          }
          aKeys.push(key);
          count++;
        } else if (propertyIsEnumerable(val2, key)) {
          return false;
        }
      }
      var symbolKeysB = objectGetOwnPropertySymbols(val2);
      if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) {
        return false;
      }
    } else {
      var _symbolKeysB = objectGetOwnPropertySymbols(val2);
      if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) {
        return false;
      }
    }
  }
  if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) {
    return true;
  } // Use memos to handle cycles.

  if (memos === undefined) {
    memos = {
      val1: new Map(),
      val2: new Map(),
      position: 0
    };
  } else {
    // We prevent up to two map.has(x) calls by directly retrieving the value
    // and checking for undefined. The map can only contain numbers, so it is
    // safe to check for undefined only.
    var val2MemoA = memos.val1.get(val1);
    if (val2MemoA !== undefined) {
      var val2MemoB = memos.val2.get(val2);
      if (val2MemoB !== undefined) {
        return val2MemoA === val2MemoB;
      }
    }
    memos.position++;
  }
  memos.val1.set(val1, memos.position);
  memos.val2.set(val2, memos.position);
  var areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType);
  memos.val1.delete(val1);
  memos.val2.delete(val2);
  return areEq;
}
function setHasEqualElement(set, val1, strict, memo) {
  // Go looking.
  var setValues = arrayFromSet(set);
  for (var i = 0; i < setValues.length; i++) {
    var val2 = setValues[i];
    if (innerDeepEqual(val1, val2, strict, memo)) {
      // Remove the matching element to make sure we do not check that again.
      set.delete(val2);
      return true;
    }
  }
  return false;
} // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Loose_equality_using
// Sadly it is not possible to detect corresponding values properly in case the
// type is a string, number, bigint or boolean. The reason is that those values
// can match lots of different string values (e.g., 1n == '+00001').

function findLooseMatchingPrimitives(prim) {
  switch (_typeof(prim)) {
    case 'undefined':
      return null;
    case 'object':
      // Only pass in null as object!
      return undefined;
    case 'symbol':
      return false;
    case 'string':
      prim = +prim;
    // Loose equal entries exist only if the string is possible to convert to
    // a regular number and not NaN.
    // Fall through

    case 'number':
      if (numberIsNaN(prim)) {
        return false;
      }
  }
  return true;
}
function setMightHaveLoosePrim(a, b, prim) {
  var altValue = findLooseMatchingPrimitives(prim);
  if (altValue != null) return altValue;
  return b.has(altValue) && !a.has(altValue);
}
function mapMightHaveLoosePrim(a, b, prim, item, memo) {
  var altValue = findLooseMatchingPrimitives(prim);
  if (altValue != null) {
    return altValue;
  }
  var curB = b.get(altValue);
  if (curB === undefined && !b.has(altValue) || !innerDeepEqual(item, curB, false, memo)) {
    return false;
  }
  return !a.has(altValue) && innerDeepEqual(item, curB, false, memo);
}
function setEquiv(a, b, strict, memo) {
  // This is a lazily initiated Set of entries which have to be compared
  // pairwise.
  var set = null;
  var aValues = arrayFromSet(a);
  for (var i = 0; i < aValues.length; i++) {
    var val = aValues[i]; // Note: Checking for the objects first improves the performance for object
    // heavy sets but it is a minor slow down for primitives. As they are fast
    // to check this improves the worst case scenario instead.

    if (_typeof(val) === 'object' && val !== null) {
      if (set === null) {
        set = new Set();
      } // If the specified value doesn't exist in the second set its an not null
      // object (or non strict only: a not matching primitive) we'll need to go
      // hunting for something thats deep-(strict-)equal to it. To make this
      // O(n log n) complexity we have to copy these values in a new set first.

      set.add(val);
    } else if (!b.has(val)) {
      if (strict) return false; // Fast path to detect missing string, symbol, undefined and null values.

      if (!setMightHaveLoosePrim(a, b, val)) {
        return false;
      }
      if (set === null) {
        set = new Set();
      }
      set.add(val);
    }
  }
  if (set !== null) {
    var bValues = arrayFromSet(b);
    for (var _i = 0; _i < bValues.length; _i++) {
      var _val = bValues[_i]; // We have to check if a primitive value is already
      // matching and only if it's not, go hunting for it.

      if (_typeof(_val) === 'object' && _val !== null) {
        if (!setHasEqualElement(set, _val, strict, memo)) return false;
      } else if (!strict && !a.has(_val) && !setHasEqualElement(set, _val, strict, memo)) {
        return false;
      }
    }
    return set.size === 0;
  }
  return true;
}
function mapHasEqualEntry(set, map, key1, item1, strict, memo) {
  // To be able to handle cases like:
  //   Map([[{}, 'a'], [{}, 'b']]) vs Map([[{}, 'b'], [{}, 'a']])
  // ... we need to consider *all* matching keys, not just the first we find.
  var setValues = arrayFromSet(set);
  for (var i = 0; i < setValues.length; i++) {
    var key2 = setValues[i];
    if (innerDeepEqual(key1, key2, strict, memo) && innerDeepEqual(item1, map.get(key2), strict, memo)) {
      set.delete(key2);
      return true;
    }
  }
  return false;
}
function mapEquiv(a, b, strict, memo) {
  var set = null;
  var aEntries = arrayFromMap(a);
  for (var i = 0; i < aEntries.length; i++) {
    var _aEntries$i = _slicedToArray(aEntries[i], 2),
      key = _aEntries$i[0],
      item1 = _aEntries$i[1];
    if (_typeof(key) === 'object' && key !== null) {
      if (set === null) {
        set = new Set();
      }
      set.add(key);
    } else {
      // By directly retrieving the value we prevent another b.has(key) check in
      // almost all possible cases.
      var item2 = b.get(key);
      if (item2 === undefined && !b.has(key) || !innerDeepEqual(item1, item2, strict, memo)) {
        if (strict) return false; // Fast path to detect missing string, symbol, undefined and null
        // keys.

        if (!mapMightHaveLoosePrim(a, b, key, item1, memo)) return false;
        if (set === null) {
          set = new Set();
        }
        set.add(key);
      }
    }
  }
  if (set !== null) {
    var bEntries = arrayFromMap(b);
    for (var _i2 = 0; _i2 < bEntries.length; _i2++) {
      var _bEntries$_i = _slicedToArray(bEntries[_i2], 2),
        key = _bEntries$_i[0],
        item = _bEntries$_i[1];
      if (_typeof(key) === 'object' && key !== null) {
        if (!mapHasEqualEntry(set, a, key, item, strict, memo)) return false;
      } else if (!strict && (!a.has(key) || !innerDeepEqual(a.get(key), item, false, memo)) && !mapHasEqualEntry(set, a, key, item, false, memo)) {
        return false;
      }
    }
    return set.size === 0;
  }
  return true;
}
function objEquiv(a, b, strict, keys, memos, iterationType) {
  // Sets and maps don't have their entries accessible via normal object
  // properties.
  var i = 0;
  if (iterationType === kIsSet) {
    if (!setEquiv(a, b, strict, memos)) {
      return false;
    }
  } else if (iterationType === kIsMap) {
    if (!mapEquiv(a, b, strict, memos)) {
      return false;
    }
  } else if (iterationType === kIsArray) {
    for (; i < a.length; i++) {
      if (hasOwnProperty(a, i)) {
        if (!hasOwnProperty(b, i) || !innerDeepEqual(a[i], b[i], strict, memos)) {
          return false;
        }
      } else if (hasOwnProperty(b, i)) {
        return false;
      } else {
        // Array is sparse.
        var keysA = Object.keys(a);
        for (; i < keysA.length; i++) {
          var key = keysA[i];
          if (!hasOwnProperty(b, key) || !innerDeepEqual(a[key], b[key], strict, memos)) {
            return false;
          }
        }
        if (keysA.length !== Object.keys(b).length) {
          return false;
        }
        return true;
      }
    }
  } // The pair must have equivalent values for every corresponding key.
  // Possibly expensive deep test:

  for (i = 0; i < keys.length; i++) {
    var _key = keys[i];
    if (!innerDeepEqual(a[_key], b[_key], strict, memos)) {
      return false;
    }
  }
  return true;
}
function isDeepEqual(val1, val2) {
  return innerDeepEqual(val1, val2, kLoose);
}
function isDeepStrictEqual(val1, val2) {
  return innerDeepEqual(val1, val2, kStrict);
}
module.exports = {
  isDeepEqual: isDeepEqual,
  isDeepStrictEqual: isDeepStrictEqual
};

/***/ }),

/***/ 1918:
/***/ ((__unused_webpack_module, exports) => {

/* bessel.js (C) 2013-present SheetJS -- http://sheetjs.com */
/* vim: set ts=2: */
/*exported BESSEL */
var BESSEL;
(function (factory) {
  /*jshint ignore:start */
  if (typeof DO_NOT_EXPORT_BESSEL === 'undefined') {
    if (true) {
      factory(exports);
    } else {}
  } else {
    factory(BESSEL = {});
  }
  /*jshint ignore:end */
})(function (BESSEL) {
  BESSEL.version = '1.0.2';
  var M = Math;
  function _horner(arr, v) {
    for (var i = 0, z = 0; i < arr.length; ++i) z = v * z + arr[i];
    return z;
  }
  function _bessel_iter(x, n, f0, f1, sign) {
    if (n === 0) return f0;
    if (n === 1) return f1;
    var tdx = 2 / x,
      f2 = f1;
    for (var o = 1; o < n; ++o) {
      f2 = f1 * o * tdx + sign * f0;
      f0 = f1;
      f1 = f2;
    }
    return f2;
  }
  function _bessel_wrap(bessel0, bessel1, name, nonzero, sign) {
    return function bessel(x, n) {
      if (nonzero) {
        if (x === 0) return nonzero == 1 ? -Infinity : Infinity;else if (x < 0) return NaN;
      }
      if (n === 0) return bessel0(x);
      if (n === 1) return bessel1(x);
      if (n < 0) return NaN;
      n |= 0;
      var b0 = bessel0(x),
        b1 = bessel1(x);
      return _bessel_iter(x, n, b0, b1, sign);
    };
  }
  var besselj = function () {
    var W = 0.636619772; // 2 / Math.PI

    var b0_a1a = [57568490574.0, -13362590354.0, 651619640.7, -11214424.18, 77392.33017, -184.9052456].reverse();
    var b0_a2a = [57568490411.0, 1029532985.0, 9494680.718, 59272.64853, 267.8532712, 1.0].reverse();
    var b0_a1b = [1.0, -0.1098628627e-2, 0.2734510407e-4, -0.2073370639e-5, 0.2093887211e-6].reverse();
    var b0_a2b = [-0.1562499995e-1, 0.1430488765e-3, -0.6911147651e-5, 0.7621095161e-6, -0.934935152e-7].reverse();
    function bessel0(x) {
      var a = 0,
        a1 = 0,
        a2 = 0,
        y = x * x;
      if (x < 8) {
        a1 = _horner(b0_a1a, y);
        a2 = _horner(b0_a2a, y);
        a = a1 / a2;
      } else {
        var xx = x - 0.785398164;
        y = 64 / y;
        a1 = _horner(b0_a1b, y);
        a2 = _horner(b0_a2b, y);
        a = M.sqrt(W / x) * (M.cos(xx) * a1 - M.sin(xx) * a2 * 8 / x);
      }
      return a;
    }
    var b1_a1a = [72362614232.0, -7895059235.0, 242396853.1, -2972611.439, 15704.48260, -30.16036606].reverse();
    var b1_a2a = [144725228442.0, 2300535178.0, 18583304.74, 99447.43394, 376.9991397, 1.0].reverse();
    var b1_a1b = [1.0, 0.183105e-2, -0.3516396496e-4, 0.2457520174e-5, -0.240337019e-6].reverse();
    var b1_a2b = [0.04687499995, -0.2002690873e-3, 0.8449199096e-5, -0.88228987e-6, 0.105787412e-6].reverse();
    function bessel1(x) {
      var a = 0,
        a1 = 0,
        a2 = 0,
        y = x * x,
        xx = M.abs(x) - 2.356194491;
      if (Math.abs(x) < 8) {
        a1 = x * _horner(b1_a1a, y);
        a2 = _horner(b1_a2a, y);
        a = a1 / a2;
      } else {
        y = 64 / y;
        a1 = _horner(b1_a1b, y);
        a2 = _horner(b1_a2b, y);
        a = M.sqrt(W / M.abs(x)) * (M.cos(xx) * a1 - M.sin(xx) * a2 * 8 / M.abs(x));
        if (x < 0) a = -a;
      }
      return a;
    }
    return function besselj(x, n) {
      n = Math.round(n);
      if (!isFinite(x)) return isNaN(x) ? x : 0;
      if (n < 0) return (n % 2 ? -1 : 1) * besselj(x, -n);
      if (x < 0) return (n % 2 ? -1 : 1) * besselj(-x, n);
      if (n === 0) return bessel0(x);
      if (n === 1) return bessel1(x);
      if (x === 0) return 0;
      var ret = 0.0;
      if (x > n) {
        ret = _bessel_iter(x, n, bessel0(x), bessel1(x), -1);
      } else {
        var m = 2 * M.floor((n + M.floor(M.sqrt(40 * n))) / 2);
        var jsum = false;
        var bjp = 0.0,
          sum = 0.0;
        var bj = 1.0,
          bjm = 0.0;
        var tox = 2 / x;
        for (var j = m; j > 0; j--) {
          bjm = j * tox * bj - bjp;
          bjp = bj;
          bj = bjm;
          if (M.abs(bj) > 1E10) {
            bj *= 1E-10;
            bjp *= 1E-10;
            ret *= 1E-10;
            sum *= 1E-10;
          }
          if (jsum) sum += bj;
          jsum = !jsum;
          if (j == n) ret = bjp;
        }
        sum = 2.0 * sum - bj;
        ret /= sum;
      }
      return ret;
    };
  }();
  var bessely = function () {
    var W = 0.636619772;
    var b0_a1a = [-2957821389.0, 7062834065.0, -512359803.6, 10879881.29, -86327.92757, 228.4622733].reverse();
    var b0_a2a = [40076544269.0, 745249964.8, 7189466.438, 47447.26470, 226.1030244, 1.0].reverse();
    var b0_a1b = [1.0, -0.1098628627e-2, 0.2734510407e-4, -0.2073370639e-5, 0.2093887211e-6].reverse();
    var b0_a2b = [-0.1562499995e-1, 0.1430488765e-3, -0.6911147651e-5, 0.7621095161e-6, -0.934945152e-7].reverse();
    function bessel0(x) {
      var a = 0,
        a1 = 0,
        a2 = 0,
        y = x * x,
        xx = x - 0.785398164;
      if (x < 8) {
        a1 = _horner(b0_a1a, y);
        a2 = _horner(b0_a2a, y);
        a = a1 / a2 + W * besselj(x, 0) * M.log(x);
      } else {
        y = 64 / y;
        a1 = _horner(b0_a1b, y);
        a2 = _horner(b0_a2b, y);
        a = M.sqrt(W / x) * (M.sin(xx) * a1 + M.cos(xx) * a2 * 8 / x);
      }
      return a;
    }
    var b1_a1a = [-0.4900604943e13, 0.1275274390e13, -0.5153438139e11, 0.7349264551e9, -0.4237922726e7, 0.8511937935e4].reverse();
    var b1_a2a = [0.2499580570e14, 0.4244419664e12, 0.3733650367e10, 0.2245904002e8, 0.1020426050e6, 0.3549632885e3, 1].reverse();
    var b1_a1b = [1.0, 0.183105e-2, -0.3516396496e-4, 0.2457520174e-5, -0.240337019e-6].reverse();
    var b1_a2b = [0.04687499995, -0.2002690873e-3, 0.8449199096e-5, -0.88228987e-6, 0.105787412e-6].reverse();
    function bessel1(x) {
      var a = 0,
        a1 = 0,
        a2 = 0,
        y = x * x,
        xx = x - 2.356194491;
      if (x < 8) {
        a1 = x * _horner(b1_a1a, y);
        a2 = _horner(b1_a2a, y);
        a = a1 / a2 + W * (besselj(x, 1) * M.log(x) - 1 / x);
      } else {
        y = 64 / y;
        a1 = _horner(b1_a1b, y);
        a2 = _horner(b1_a2b, y);
        a = M.sqrt(W / x) * (M.sin(xx) * a1 + M.cos(xx) * a2 * 8 / x);
      }
      return a;
    }
    return _bessel_wrap(bessel0, bessel1, 'BESSELY', 1, -1);
  }();
  var besseli = function () {
    var b0_a = [1.0, 3.5156229, 3.0899424, 1.2067492, 0.2659732, 0.360768e-1, 0.45813e-2].reverse();
    var b0_b = [0.39894228, 0.1328592e-1, 0.225319e-2, -0.157565e-2, 0.916281e-2, -0.2057706e-1, 0.2635537e-1, -0.1647633e-1, 0.392377e-2].reverse();
    function bessel0(x) {
      if (x <= 3.75) return _horner(b0_a, x * x / (3.75 * 3.75));
      return M.exp(M.abs(x)) / M.sqrt(M.abs(x)) * _horner(b0_b, 3.75 / M.abs(x));
    }
    var b1_a = [0.5, 0.87890594, 0.51498869, 0.15084934, 0.2658733e-1, 0.301532e-2, 0.32411e-3].reverse();
    var b1_b = [0.39894228, -0.3988024e-1, -0.362018e-2, 0.163801e-2, -0.1031555e-1, 0.2282967e-1, -0.2895312e-1, 0.1787654e-1, -0.420059e-2].reverse();
    function bessel1(x) {
      if (x < 3.75) return x * _horner(b1_a, x * x / (3.75 * 3.75));
      return (x < 0 ? -1 : 1) * M.exp(M.abs(x)) / M.sqrt(M.abs(x)) * _horner(b1_b, 3.75 / M.abs(x));
    }
    return function besseli(x, n) {
      n = Math.round(n);
      if (n === 0) return bessel0(x);
      if (n === 1) return bessel1(x);
      if (n < 0) return NaN;
      if (M.abs(x) === 0) return 0;
      if (x == Infinity) return Infinity;
      var ret = 0.0,
        j,
        tox = 2 / M.abs(x),
        bip = 0.0,
        bi = 1.0,
        bim = 0.0;
      var m = 2 * M.round((n + M.round(M.sqrt(40 * n))) / 2);
      for (j = m; j > 0; j--) {
        bim = j * tox * bi + bip;
        bip = bi;
        bi = bim;
        if (M.abs(bi) > 1E10) {
          bi *= 1E-10;
          bip *= 1E-10;
          ret *= 1E-10;
        }
        if (j == n) ret = bip;
      }
      ret *= besseli(x, 0) / bi;
      return x < 0 && n % 2 ? -ret : ret;
    };
  }();
  var besselk = function () {
    var b0_a = [-0.57721566, 0.42278420, 0.23069756, 0.3488590e-1, 0.262698e-2, 0.10750e-3, 0.74e-5].reverse();
    var b0_b = [1.25331414, -0.7832358e-1, 0.2189568e-1, -0.1062446e-1, 0.587872e-2, -0.251540e-2, 0.53208e-3].reverse();
    function bessel0(x) {
      if (x <= 2) return -M.log(x / 2) * besseli(x, 0) + _horner(b0_a, x * x / 4);
      return M.exp(-x) / M.sqrt(x) * _horner(b0_b, 2 / x);
    }
    var b1_a = [1.0, 0.15443144, -0.67278579, -0.18156897, -0.1919402e-1, -0.110404e-2, -0.4686e-4].reverse();
    var b1_b = [1.25331414, 0.23498619, -0.3655620e-1, 0.1504268e-1, -0.780353e-2, 0.325614e-2, -0.68245e-3].reverse();
    function bessel1(x) {
      if (x <= 2) return M.log(x / 2) * besseli(x, 1) + 1 / x * _horner(b1_a, x * x / 4);
      return M.exp(-x) / M.sqrt(x) * _horner(b1_b, 2 / x);
    }
    return _bessel_wrap(bessel0, bessel1, 'BESSELK', 2, 1);
  }();
  BESSEL.besselj = besselj;
  BESSEL.bessely = bessely;
  BESSEL.besseli = besseli;
  BESSEL.besselk = besselk;
});

/***/ }),

/***/ 1784:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var GetIntrinsic = __webpack_require__(9052);
var callBind = __webpack_require__(1112);
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
module.exports = function callBoundIntrinsic(name, allowMissing) {
  var intrinsic = GetIntrinsic(name, !!allowMissing);
  if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
    return callBind(intrinsic);
  }
  return intrinsic;
};

/***/ }),

/***/ 1112:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var bind = __webpack_require__(1216);
var GetIntrinsic = __webpack_require__(9052);
var $apply = GetIntrinsic('%Function.prototype.apply%');
var $call = GetIntrinsic('%Function.prototype.call%');
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
var $max = GetIntrinsic('%Math.max%');
if ($defineProperty) {
  try {
    $defineProperty({}, 'a', {
      value: 1
    });
  } catch (e) {
    // IE 8 has a broken defineProperty
    $defineProperty = null;
  }
}
module.exports = function callBind(originalFunction) {
  var func = $reflectApply(bind, $call, arguments);
  if ($gOPD && $defineProperty) {
    var desc = $gOPD(func, 'length');
    if (desc.configurable) {
      // original length, plus the receiver, minus any additional arguments (after the receiver)
      $defineProperty(func, 'length', {
        value: 1 + $max(0, originalFunction.length - (arguments.length - 1))
      });
    }
  }
  return func;
};
var applyBind = function applyBind() {
  return $reflectApply(bind, $apply, arguments);
};
if ($defineProperty) {
  $defineProperty(module.exports, 'apply', {
    value: applyBind
  });
} else {
  module.exports.apply = applyBind;
}

/***/ }),

/***/ 3639:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/*global window, global*/
var util = __webpack_require__(4485);
var assert = __webpack_require__(4725);
function now() {
  return new Date().getTime();
}
var slice = Array.prototype.slice;
var console;
var times = {};
if (typeof __webpack_require__.g !== "undefined" && __webpack_require__.g.console) {
  console = __webpack_require__.g.console;
} else if (typeof window !== "undefined" && window.console) {
  console = window.console;
} else {
  console = {};
}
var functions = [[log, "log"], [info, "info"], [warn, "warn"], [error, "error"], [time, "time"], [timeEnd, "timeEnd"], [trace, "trace"], [dir, "dir"], [consoleAssert, "assert"]];
for (var i = 0; i < functions.length; i++) {
  var tuple = functions[i];
  var f = tuple[0];
  var name = tuple[1];
  if (!console[name]) {
    console[name] = f;
  }
}
module.exports = console;
function log() {}
function info() {
  console.log.apply(console, arguments);
}
function warn() {
  console.log.apply(console, arguments);
}
function error() {
  console.warn.apply(console, arguments);
}
function time(label) {
  times[label] = now();
}
function timeEnd(label) {
  var time = times[label];
  if (!time) {
    throw new Error("No such label: " + label);
  }
  delete times[label];
  var duration = now() - time;
  console.log(label + ": " + duration + "ms");
}
function trace() {
  var err = new Error();
  err.name = "Trace";
  err.message = util.format.apply(null, arguments);
  console.error(err.stack);
}
function dir(object) {
  console.log(util.inspect(object) + "\n");
}
function consoleAssert(expression) {
  if (!expression) {
    var arr = slice.call(arguments, 1);
    assert.ok(false, util.format.apply(null, arr));
  }
}

/***/ }),

/***/ 1779:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var keys = __webpack_require__(2278);
var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
var toStr = Object.prototype.toString;
var concat = Array.prototype.concat;
var origDefineProperty = Object.defineProperty;
var isFunction = function (fn) {
  return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
};
var hasPropertyDescriptors = __webpack_require__(6123)();
var supportsDescriptors = origDefineProperty && hasPropertyDescriptors;
var defineProperty = function (object, name, value, predicate) {
  if (name in object) {
    if (predicate === true) {
      if (object[name] === value) {
        return;
      }
    } else if (!isFunction(predicate) || !predicate()) {
      return;
    }
  }
  if (supportsDescriptors) {
    origDefineProperty(object, name, {
      configurable: true,
      enumerable: false,
      value: value,
      writable: true
    });
  } else {
    object[name] = value; // eslint-disable-line no-param-reassign
  }
};

var defineProperties = function (object, map) {
  var predicates = arguments.length > 2 ? arguments[2] : {};
  var props = keys(map);
  if (hasSymbols) {
    props = concat.call(props, Object.getOwnPropertySymbols(map));
  }
  for (var i = 0; i < props.length; i += 1) {
    defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
  }
};
defineProperties.supportsDescriptors = !!supportsDescriptors;
module.exports = defineProperties;

/***/ }),

/***/ 5114:
/***/ ((module) => {

"use strict";
/**
 * Code refactored from Mozilla Developer Network:
 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
 */



function assign(target, firstSource) {
  if (target === undefined || target === null) {
    throw new TypeError('Cannot convert first argument to object');
  }
  var to = Object(target);
  for (var i = 1; i < arguments.length; i++) {
    var nextSource = arguments[i];
    if (nextSource === undefined || nextSource === null) {
      continue;
    }
    var keysArray = Object.keys(Object(nextSource));
    for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
      var nextKey = keysArray[nextIndex];
      var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
      if (desc !== undefined && desc.enumerable) {
        to[nextKey] = nextSource[nextKey];
      }
    }
  }
  return to;
}
function polyfill() {
  if (!Object.assign) {
    Object.defineProperty(Object, 'assign', {
      enumerable: false,
      configurable: true,
      writable: true,
      value: assign
    });
  }
}
module.exports = {
  assign: assign,
  polyfill: polyfill
};

/***/ }),

/***/ 2435:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var isCallable = __webpack_require__(9658);
var toStr = Object.prototype.toString;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var forEachArray = function forEachArray(array, iterator, receiver) {
  for (var i = 0, len = array.length; i < len; i++) {
    if (hasOwnProperty.call(array, i)) {
      if (receiver == null) {
        iterator(array[i], i, array);
      } else {
        iterator.call(receiver, array[i], i, array);
      }
    }
  }
};
var forEachString = function forEachString(string, iterator, receiver) {
  for (var i = 0, len = string.length; i < len; i++) {
    // no such thing as a sparse string.
    if (receiver == null) {
      iterator(string.charAt(i), i, string);
    } else {
      iterator.call(receiver, string.charAt(i), i, string);
    }
  }
};
var forEachObject = function forEachObject(object, iterator, receiver) {
  for (var k in object) {
    if (hasOwnProperty.call(object, k)) {
      if (receiver == null) {
        iterator(object[k], k, object);
      } else {
        iterator.call(receiver, object[k], k, object);
      }
    }
  }
};
var forEach = function forEach(list, iterator, thisArg) {
  if (!isCallable(iterator)) {
    throw new TypeError('iterator must be a function');
  }
  var receiver;
  if (arguments.length >= 3) {
    receiver = thisArg;
  }
  if (toStr.call(list) === '[object Array]') {
    forEachArray(list, iterator, receiver);
  } else if (typeof list === 'string') {
    forEachString(list, iterator, receiver);
  } else {
    forEachObject(list, iterator, receiver);
  }
};
module.exports = forEach;

/***/ }),

/***/ 305:
/***/ ((module) => {

"use strict";


/* eslint no-invalid-this: 1 */
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
var slice = Array.prototype.slice;
var toStr = Object.prototype.toString;
var funcType = '[object Function]';
module.exports = function bind(that) {
  var target = this;
  if (typeof target !== 'function' || toStr.call(target) !== funcType) {
    throw new TypeError(ERROR_MESSAGE + target);
  }
  var args = slice.call(arguments, 1);
  var bound;
  var binder = function () {
    if (this instanceof bound) {
      var result = target.apply(this, args.concat(slice.call(arguments)));
      if (Object(result) === result) {
        return result;
      }
      return this;
    } else {
      return target.apply(that, args.concat(slice.call(arguments)));
    }
  };
  var boundLength = Math.max(0, target.length - args.length);
  var boundArgs = [];
  for (var i = 0; i < boundLength; i++) {
    boundArgs.push('$' + i);
  }
  bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
  if (target.prototype) {
    var Empty = function Empty() {};
    Empty.prototype = target.prototype;
    bound.prototype = new Empty();
    Empty.prototype = null;
  }
  return bound;
};

/***/ }),

/***/ 1216:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var implementation = __webpack_require__(305);
module.exports = Function.prototype.bind || implementation;

/***/ }),

/***/ 9052:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var undefined;
var $SyntaxError = SyntaxError;
var $Function = Function;
var $TypeError = TypeError;

// eslint-disable-next-line consistent-return
var getEvalledConstructor = function (expressionSyntax) {
  try {
    return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
  } catch (e) {}
};
var $gOPD = Object.getOwnPropertyDescriptor;
if ($gOPD) {
  try {
    $gOPD({}, '');
  } catch (e) {
    $gOPD = null; // this is IE 8, which has a broken gOPD
  }
}

var throwTypeError = function () {
  throw new $TypeError();
};
var ThrowTypeError = $gOPD ? function () {
  try {
    // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
    arguments.callee; // IE 8 does not throw here
    return throwTypeError;
  } catch (calleeThrows) {
    try {
      // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
      return $gOPD(arguments, 'callee').get;
    } catch (gOPDthrows) {
      return throwTypeError;
    }
  }
}() : throwTypeError;
var hasSymbols = __webpack_require__(2891)();
var hasProto = __webpack_require__(3564)();
var getProto = Object.getPrototypeOf || (hasProto ? function (x) {
  return x.__proto__;
} // eslint-disable-line no-proto
: null);
var needsEval = {};
var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array);
var INTRINSICS = {
  '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
  '%Array%': Array,
  '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
  '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined,
  '%AsyncFromSyncIteratorPrototype%': undefined,
  '%AsyncFunction%': needsEval,
  '%AsyncGenerator%': needsEval,
  '%AsyncGeneratorFunction%': needsEval,
  '%AsyncIteratorPrototype%': needsEval,
  '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
  '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
  '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,
  '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,
  '%Boolean%': Boolean,
  '%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
  '%Date%': Date,
  '%decodeURI%': decodeURI,
  '%decodeURIComponent%': decodeURIComponent,
  '%encodeURI%': encodeURI,
  '%encodeURIComponent%': encodeURIComponent,
  '%Error%': Error,
  '%eval%': eval,
  // eslint-disable-line no-eval
  '%EvalError%': EvalError,
  '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
  '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
  '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
  '%Function%': $Function,
  '%GeneratorFunction%': needsEval,
  '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
  '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
  '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
  '%isFinite%': isFinite,
  '%isNaN%': isNaN,
  '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,
  '%JSON%': typeof JSON === 'object' ? JSON : undefined,
  '%Map%': typeof Map === 'undefined' ? undefined : Map,
  '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()),
  '%Math%': Math,
  '%Number%': Number,
  '%Object%': Object,
  '%parseFloat%': parseFloat,
  '%parseInt%': parseInt,
  '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
  '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
  '%RangeError%': RangeError,
  '%ReferenceError%': ReferenceError,
  '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
  '%RegExp%': RegExp,
  '%Set%': typeof Set === 'undefined' ? undefined : Set,
  '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()),
  '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
  '%String%': String,
  '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined,
  '%Symbol%': hasSymbols ? Symbol : undefined,
  '%SyntaxError%': $SyntaxError,
  '%ThrowTypeError%': ThrowTypeError,
  '%TypedArray%': TypedArray,
  '%TypeError%': $TypeError,
  '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
  '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
  '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
  '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
  '%URIError%': URIError,
  '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
  '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
  '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
};
if (getProto) {
  try {
    null.error; // eslint-disable-line no-unused-expressions
  } catch (e) {
    // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
    var errorProto = getProto(getProto(e));
    INTRINSICS['%Error.prototype%'] = errorProto;
  }
}
var doEval = function doEval(name) {
  var value;
  if (name === '%AsyncFunction%') {
    value = getEvalledConstructor('async function () {}');
  } else if (name === '%GeneratorFunction%') {
    value = getEvalledConstructor('function* () {}');
  } else if (name === '%AsyncGeneratorFunction%') {
    value = getEvalledConstructor('async function* () {}');
  } else if (name === '%AsyncGenerator%') {
    var fn = doEval('%AsyncGeneratorFunction%');
    if (fn) {
      value = fn.prototype;
    }
  } else if (name === '%AsyncIteratorPrototype%') {
    var gen = doEval('%AsyncGenerator%');
    if (gen && getProto) {
      value = getProto(gen.prototype);
    }
  }
  INTRINSICS[name] = value;
  return value;
};
var LEGACY_ALIASES = {
  '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
  '%ArrayPrototype%': ['Array', 'prototype'],
  '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
  '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
  '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
  '%ArrayProto_values%': ['Array', 'prototype', 'values'],
  '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
  '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
  '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
  '%BooleanPrototype%': ['Boolean', 'prototype'],
  '%DataViewPrototype%': ['DataView', 'prototype'],
  '%DatePrototype%': ['Date', 'prototype'],
  '%ErrorPrototype%': ['Error', 'prototype'],
  '%EvalErrorPrototype%': ['EvalError', 'prototype'],
  '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
  '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
  '%FunctionPrototype%': ['Function', 'prototype'],
  '%Generator%': ['GeneratorFunction', 'prototype'],
  '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
  '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
  '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
  '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
  '%JSONParse%': ['JSON', 'parse'],
  '%JSONStringify%': ['JSON', 'stringify'],
  '%MapPrototype%': ['Map', 'prototype'],
  '%NumberPrototype%': ['Number', 'prototype'],
  '%ObjectPrototype%': ['Object', 'prototype'],
  '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
  '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
  '%PromisePrototype%': ['Promise', 'prototype'],
  '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
  '%Promise_all%': ['Promise', 'all'],
  '%Promise_reject%': ['Promise', 'reject'],
  '%Promise_resolve%': ['Promise', 'resolve'],
  '%RangeErrorPrototype%': ['RangeError', 'prototype'],
  '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
  '%RegExpPrototype%': ['RegExp', 'prototype'],
  '%SetPrototype%': ['Set', 'prototype'],
  '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
  '%StringPrototype%': ['String', 'prototype'],
  '%SymbolPrototype%': ['Symbol', 'prototype'],
  '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
  '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
  '%TypeErrorPrototype%': ['TypeError', 'prototype'],
  '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
  '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
  '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
  '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
  '%URIErrorPrototype%': ['URIError', 'prototype'],
  '%WeakMapPrototype%': ['WeakMap', 'prototype'],
  '%WeakSetPrototype%': ['WeakSet', 'prototype']
};
var bind = __webpack_require__(1216);
var hasOwn = __webpack_require__(9095);
var $concat = bind.call(Function.call, Array.prototype.concat);
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
var $replace = bind.call(Function.call, String.prototype.replace);
var $strSlice = bind.call(Function.call, String.prototype.slice);
var $exec = bind.call(Function.call, RegExp.prototype.exec);

/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
var stringToPath = function stringToPath(string) {
  var first = $strSlice(string, 0, 1);
  var last = $strSlice(string, -1);
  if (first === '%' && last !== '%') {
    throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
  } else if (last === '%' && first !== '%') {
    throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
  }
  var result = [];
  $replace(string, rePropName, function (match, number, quote, subString) {
    result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
  });
  return result;
};
/* end adaptation */

var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
  var intrinsicName = name;
  var alias;
  if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
    alias = LEGACY_ALIASES[intrinsicName];
    intrinsicName = '%' + alias[0] + '%';
  }
  if (hasOwn(INTRINSICS, intrinsicName)) {
    var value = INTRINSICS[intrinsicName];
    if (value === needsEval) {
      value = doEval(intrinsicName);
    }
    if (typeof value === 'undefined' && !allowMissing) {
      throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
    }
    return {
      alias: alias,
      name: intrinsicName,
      value: value
    };
  }
  throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
};
module.exports = function GetIntrinsic(name, allowMissing) {
  if (typeof name !== 'string' || name.length === 0) {
    throw new $TypeError('intrinsic name must be a non-empty string');
  }
  if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
    throw new $TypeError('"allowMissing" argument must be a boolean');
  }
  if ($exec(/^%?[^%]*%?$/, name) === null) {
    throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
  }
  var parts = stringToPath(name);
  var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
  var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
  var intrinsicRealName = intrinsic.name;
  var value = intrinsic.value;
  var skipFurtherCaching = false;
  var alias = intrinsic.alias;
  if (alias) {
    intrinsicBaseName = alias[0];
    $spliceApply(parts, $concat([0, 1], alias));
  }
  for (var i = 1, isOwn = true; i < parts.length; i += 1) {
    var part = parts[i];
    var first = $strSlice(part, 0, 1);
    var last = $strSlice(part, -1);
    if ((first === '"' || first === "'" || first === '`' || last === '"' || last === "'" || last === '`') && first !== last) {
      throw new $SyntaxError('property names with quotes must have matching quotes');
    }
    if (part === 'constructor' || !isOwn) {
      skipFurtherCaching = true;
    }
    intrinsicBaseName += '.' + part;
    intrinsicRealName = '%' + intrinsicBaseName + '%';
    if (hasOwn(INTRINSICS, intrinsicRealName)) {
      value = INTRINSICS[intrinsicRealName];
    } else if (value != null) {
      if (!(part in value)) {
        if (!allowMissing) {
          throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
        }
        return void undefined;
      }
      if ($gOPD && i + 1 >= parts.length) {
        var desc = $gOPD(value, part);
        isOwn = !!desc;

        // By convention, when a data property is converted to an accessor
        // property to emulate a data property that does not suffer from
        // the override mistake, that accessor's getter is marked with
        // an `originalValue` property. Here, when we detect this, we
        // uphold the illusion by pretending to see that original data
        // property, i.e., returning the value rather than the getter
        // itself.
        if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
          value = desc.get;
        } else {
          value = value[part];
        }
      } else {
        isOwn = hasOwn(value, part);
        value = value[part];
      }
      if (isOwn && !skipFurtherCaching) {
        INTRINSICS[intrinsicRealName] = value;
      }
    }
  }
  return value;
};

/***/ }),

/***/ 8280:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var GetIntrinsic = __webpack_require__(9052);
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
if ($gOPD) {
  try {
    $gOPD([], 'length');
  } catch (e) {
    // IE 8 has a broken gOPD
    $gOPD = null;
  }
}
module.exports = $gOPD;

/***/ }),

/***/ 6123:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var GetIntrinsic = __webpack_require__(9052);
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
var hasPropertyDescriptors = function hasPropertyDescriptors() {
  if ($defineProperty) {
    try {
      $defineProperty({}, 'a', {
        value: 1
      });
      return true;
    } catch (e) {
      // IE 8 has a broken defineProperty
      return false;
    }
  }
  return false;
};
hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
  // node v0.6 has a bug where array lengths can be Set but not Defined
  if (!hasPropertyDescriptors()) {
    return null;
  }
  try {
    return $defineProperty([], 'length', {
      value: 1
    }).length !== 1;
  } catch (e) {
    // In Firefox 4-22, defining length on an array throws an exception.
    return true;
  }
};
module.exports = hasPropertyDescriptors;

/***/ }),

/***/ 3564:
/***/ ((module) => {

"use strict";


var test = {
  foo: {}
};
var $Object = Object;
module.exports = function hasProto() {
  return {
    __proto__: test
  }.foo === test.foo && !({
    __proto__: null
  } instanceof $Object);
};

/***/ }),

/***/ 2891:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var origSymbol = typeof Symbol !== 'undefined' && Symbol;
var hasSymbolSham = __webpack_require__(5590);
module.exports = function hasNativeSymbols() {
  if (typeof origSymbol !== 'function') {
    return false;
  }
  if (typeof Symbol !== 'function') {
    return false;
  }
  if (typeof origSymbol('foo') !== 'symbol') {
    return false;
  }
  if (typeof Symbol('bar') !== 'symbol') {
    return false;
  }
  return hasSymbolSham();
};

/***/ }),

/***/ 5590:
/***/ ((module) => {

"use strict";


/* eslint complexity: [2, 18], max-statements: [2, 33] */
module.exports = function hasSymbols() {
  if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') {
    return false;
  }
  if (typeof Symbol.iterator === 'symbol') {
    return true;
  }
  var obj = {};
  var sym = Symbol('test');
  var symObj = Object(sym);
  if (typeof sym === 'string') {
    return false;
  }
  if (Object.prototype.toString.call(sym) !== '[object Symbol]') {
    return false;
  }
  if (Object.prototype.toString.call(symObj) !== '[object Symbol]') {
    return false;
  }

  // temp disabled per https://github.com/ljharb/object.assign/issues/17
  // if (sym instanceof Symbol) { return false; }
  // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
  // if (!(symObj instanceof Symbol)) { return false; }

  // if (typeof Symbol.prototype.toString !== 'function') { return false; }
  // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }

  var symVal = 42;
  obj[sym] = symVal;
  for (sym in obj) {
    return false;
  } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
  if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) {
    return false;
  }
  if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) {
    return false;
  }
  var syms = Object.getOwnPropertySymbols(obj);
  if (syms.length !== 1 || syms[0] !== sym) {
    return false;
  }
  if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {
    return false;
  }
  if (typeof Object.getOwnPropertyDescriptor === 'function') {
    var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
    if (descriptor.value !== symVal || descriptor.enumerable !== true) {
      return false;
    }
  }
  return true;
};

/***/ }),

/***/ 4865:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var hasSymbols = __webpack_require__(5590);
module.exports = function hasToStringTagShams() {
  return hasSymbols() && !!Symbol.toStringTag;
};

/***/ }),

/***/ 9095:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var bind = __webpack_require__(1216);
module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);

/***/ }),

/***/ 7592:
/***/ ((module) => {

if (typeof Object.create === 'function') {
  // implementation from standard node.js 'util' module
  module.exports = function inherits(ctor, superCtor) {
    if (superCtor) {
      ctor.super_ = superCtor;
      ctor.prototype = Object.create(superCtor.prototype, {
        constructor: {
          value: ctor,
          enumerable: false,
          writable: true,
          configurable: true
        }
      });
    }
  };
} else {
  // old school shim for old browsers
  module.exports = function inherits(ctor, superCtor) {
    if (superCtor) {
      ctor.super_ = superCtor;
      var TempCtor = function () {};
      TempCtor.prototype = superCtor.prototype;
      ctor.prototype = new TempCtor();
      ctor.prototype.constructor = ctor;
    }
  };
}

/***/ }),

/***/ 4662:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var hasToStringTag = __webpack_require__(4865)();
var callBound = __webpack_require__(1784);
var $toString = callBound('Object.prototype.toString');
var isStandardArguments = function isArguments(value) {
  if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {
    return false;
  }
  return $toString(value) === '[object Arguments]';
};
var isLegacyArguments = function isArguments(value) {
  if (isStandardArguments(value)) {
    return true;
  }
  return value !== null && typeof value === 'object' && typeof value.length === 'number' && value.length >= 0 && $toString(value) !== '[object Array]' && $toString(value.callee) === '[object Function]';
};
var supportsStandardArguments = function () {
  return isStandardArguments(arguments);
}();
isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests

module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;

/***/ }),

/***/ 9658:
/***/ ((module) => {

"use strict";


var fnToStr = Function.prototype.toString;
var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
var badArrayLike;
var isCallableMarker;
if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
  try {
    badArrayLike = Object.defineProperty({}, 'length', {
      get: function () {
        throw isCallableMarker;
      }
    });
    isCallableMarker = {};
    // eslint-disable-next-line no-throw-literal
    reflectApply(function () {
      throw 42;
    }, null, badArrayLike);
  } catch (_) {
    if (_ !== isCallableMarker) {
      reflectApply = null;
    }
  }
} else {
  reflectApply = null;
}
var constructorRegex = /^\s*class\b/;
var isES6ClassFn = function isES6ClassFunction(value) {
  try {
    var fnStr = fnToStr.call(value);
    return constructorRegex.test(fnStr);
  } catch (e) {
    return false; // not a function
  }
};

var tryFunctionObject = function tryFunctionToStr(value) {
  try {
    if (isES6ClassFn(value)) {
      return false;
    }
    fnToStr.call(value);
    return true;
  } catch (e) {
    return false;
  }
};
var toStr = Object.prototype.toString;
var objectClass = '[object Object]';
var fnClass = '[object Function]';
var genClass = '[object GeneratorFunction]';
var ddaClass = '[object HTMLAllCollection]'; // IE 11
var ddaClass2 = '[object HTML document.all class]';
var ddaClass3 = '[object HTMLCollection]'; // IE 9-10
var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag`

var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing

var isDDA = function isDocumentDotAll() {
  return false;
};
if (typeof document === 'object') {
  // Firefox 3 canonicalizes DDA to undefined when it's not accessed directly
  var all = document.all;
  if (toStr.call(all) === toStr.call(document.all)) {
    isDDA = function isDocumentDotAll(value) {
      /* globals document: false */
      // in IE 6-8, typeof document.all is "object" and it's truthy
      if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) {
        try {
          var str = toStr.call(value);
          return (str === ddaClass || str === ddaClass2 || str === ddaClass3 // opera 12.16
          || str === objectClass // IE 6-8
          ) && value('') == null; // eslint-disable-line eqeqeq
        } catch (e) {/**/}
      }
      return false;
    };
  }
}
module.exports = reflectApply ? function isCallable(value) {
  if (isDDA(value)) {
    return true;
  }
  if (!value) {
    return false;
  }
  if (typeof value !== 'function' && typeof value !== 'object') {
    return false;
  }
  try {
    reflectApply(value, null, badArrayLike);
  } catch (e) {
    if (e !== isCallableMarker) {
      return false;
    }
  }
  return !isES6ClassFn(value) && tryFunctionObject(value);
} : function isCallable(value) {
  if (isDDA(value)) {
    return true;
  }
  if (!value) {
    return false;
  }
  if (typeof value !== 'function' && typeof value !== 'object') {
    return false;
  }
  if (hasToStringTag) {
    return tryFunctionObject(value);
  }
  if (isES6ClassFn(value)) {
    return false;
  }
  var strClass = toStr.call(value);
  if (strClass !== fnClass && strClass !== genClass && !/^\[object HTML/.test(strClass)) {
    return false;
  }
  return tryFunctionObject(value);
};

/***/ }),

/***/ 9672:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var toStr = Object.prototype.toString;
var fnToStr = Function.prototype.toString;
var isFnRegex = /^\s*(?:function)?\*/;
var hasToStringTag = __webpack_require__(4865)();
var getProto = Object.getPrototypeOf;
var getGeneratorFunc = function () {
  // eslint-disable-line consistent-return
  if (!hasToStringTag) {
    return false;
  }
  try {
    return Function('return function*() {}')();
  } catch (e) {}
};
var GeneratorFunction;
module.exports = function isGeneratorFunction(fn) {
  if (typeof fn !== 'function') {
    return false;
  }
  if (isFnRegex.test(fnToStr.call(fn))) {
    return true;
  }
  if (!hasToStringTag) {
    var str = toStr.call(fn);
    return str === '[object GeneratorFunction]';
  }
  if (!getProto) {
    return false;
  }
  if (typeof GeneratorFunction === 'undefined') {
    var generatorFunc = getGeneratorFunc();
    GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false;
  }
  return getProto(fn) === GeneratorFunction;
};

/***/ }),

/***/ 459:
/***/ ((module) => {

"use strict";


/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */
module.exports = function isNaN(value) {
  return value !== value;
};

/***/ }),

/***/ 3476:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var callBind = __webpack_require__(1112);
var define = __webpack_require__(1779);
var implementation = __webpack_require__(459);
var getPolyfill = __webpack_require__(481);
var shim = __webpack_require__(2193);
var polyfill = callBind(getPolyfill(), Number);

/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */

define(polyfill, {
  getPolyfill: getPolyfill,
  implementation: implementation,
  shim: shim
});
module.exports = polyfill;

/***/ }),

/***/ 481:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var implementation = __webpack_require__(459);
module.exports = function getPolyfill() {
  if (Number.isNaN && Number.isNaN(NaN) && !Number.isNaN('a')) {
    return Number.isNaN;
  }
  return implementation;
};

/***/ }),

/***/ 2193:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var define = __webpack_require__(1779);
var getPolyfill = __webpack_require__(481);

/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */

module.exports = function shimNumberIsNaN() {
  var polyfill = getPolyfill();
  define(Number, {
    isNaN: polyfill
  }, {
    isNaN: function testIsNaN() {
      return Number.isNaN !== polyfill;
    }
  });
  return polyfill;
};

/***/ }),

/***/ 4460:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var forEach = __webpack_require__(2435);
var availableTypedArrays = __webpack_require__(7086);
var callBound = __webpack_require__(1784);
var $toString = callBound('Object.prototype.toString');
var hasToStringTag = __webpack_require__(4865)();
var gOPD = __webpack_require__(8280);
var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis;
var typedArrays = availableTypedArrays();
var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {
  for (var i = 0; i < array.length; i += 1) {
    if (array[i] === value) {
      return i;
    }
  }
  return -1;
};
var $slice = callBound('String.prototype.slice');
var toStrTags = {};
var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');
if (hasToStringTag && gOPD && getPrototypeOf) {
  forEach(typedArrays, function (typedArray) {
    var arr = new g[typedArray]();
    if (Symbol.toStringTag in arr) {
      var proto = getPrototypeOf(arr);
      var descriptor = gOPD(proto, Symbol.toStringTag);
      if (!descriptor) {
        var superProto = getPrototypeOf(proto);
        descriptor = gOPD(superProto, Symbol.toStringTag);
      }
      toStrTags[typedArray] = descriptor.get;
    }
  });
}
var tryTypedArrays = function tryAllTypedArrays(value) {
  var anyTrue = false;
  forEach(toStrTags, function (getter, typedArray) {
    if (!anyTrue) {
      try {
        anyTrue = getter.call(value) === typedArray;
      } catch (e) {/**/}
    }
  });
  return anyTrue;
};
module.exports = function isTypedArray(value) {
  if (!value || typeof value !== 'object') {
    return false;
  }
  if (!hasToStringTag || !(Symbol.toStringTag in value)) {
    var tag = $slice($toString(value), 8, -1);
    return $indexOf(typedArrays, tag) > -1;
  }
  if (!gOPD) {
    return false;
  }
  return tryTypedArrays(value);
};

/***/ }),

/***/ 9387:
/***/ (function(module) {

(function (window, factory) {
  if (true) {
    module.exports = factory();
  } else {}
})(this, function () {
  var jStat = function (Math, undefined) {
    // For quick reference.
    var concat = Array.prototype.concat;
    var slice = Array.prototype.slice;
    var toString = Object.prototype.toString;

    // Calculate correction for IEEE error
    // TODO: This calculation can be improved.
    function calcRdx(n, m) {
      var val = n > m ? n : m;
      return Math.pow(10, 17 - ~~(Math.log(val > 0 ? val : -val) * Math.LOG10E));
    }
    var isArray = Array.isArray || function isArray(arg) {
      return toString.call(arg) === '[object Array]';
    };
    function isFunction(arg) {
      return toString.call(arg) === '[object Function]';
    }
    function isNumber(num) {
      return typeof num === 'number' ? num - num === 0 : false;
    }

    // Converts the jStat matrix to vector.
    function toVector(arr) {
      return concat.apply([], arr);
    }

    // The one and only jStat constructor.
    function jStat() {
      return new jStat._init(arguments);
    }

    // TODO: Remove after all references in src files have been removed.
    jStat.fn = jStat.prototype;

    // By separating the initializer from the constructor it's easier to handle
    // always returning a new instance whether "new" was used or not.
    jStat._init = function _init(args) {
      // If first argument is an array, must be vector or matrix.
      if (isArray(args[0])) {
        // Check if matrix.
        if (isArray(args[0][0])) {
          // See if a mapping function was also passed.
          if (isFunction(args[1])) args[0] = jStat.map(args[0], args[1]);
          // Iterate over each is faster than this.push.apply(this, args[0].
          for (var i = 0; i < args[0].length; i++) this[i] = args[0][i];
          this.length = args[0].length;

          // Otherwise must be a vector.
        } else {
          this[0] = isFunction(args[1]) ? jStat.map(args[0], args[1]) : args[0];
          this.length = 1;
        }

        // If first argument is number, assume creation of sequence.
      } else if (isNumber(args[0])) {
        this[0] = jStat.seq.apply(null, args);
        this.length = 1;

        // Handle case when jStat object is passed to jStat.
      } else if (args[0] instanceof jStat) {
        // Duplicate the object and pass it back.
        return jStat(args[0].toArray());

        // Unexpected argument value, return empty jStat object.
        // TODO: This is strange behavior. Shouldn't this throw or some such to let
        // the user know they had bad arguments?
      } else {
        this[0] = [];
        this.length = 1;
      }
      return this;
    };
    jStat._init.prototype = jStat.prototype;
    jStat._init.constructor = jStat;

    // Utility functions.
    // TODO: for internal use only?
    jStat.utils = {
      calcRdx: calcRdx,
      isArray: isArray,
      isFunction: isFunction,
      isNumber: isNumber,
      toVector: toVector
    };
    jStat._random_fn = Math.random;
    jStat.setRandom = function setRandom(fn) {
      if (typeof fn !== 'function') throw new TypeError('fn is not a function');
      jStat._random_fn = fn;
    };

    // Easily extend the jStat object.
    // TODO: is this seriously necessary?
    jStat.extend = function extend(obj) {
      var i, j;
      if (arguments.length === 1) {
        for (j in obj) jStat[j] = obj[j];
        return this;
      }
      for (i = 1; i < arguments.length; i++) {
        for (j in arguments[i]) obj[j] = arguments[i][j];
      }
      return obj;
    };

    // Returns the number of rows in the matrix.
    jStat.rows = function rows(arr) {
      return arr.length || 1;
    };

    // Returns the number of columns in the matrix.
    jStat.cols = function cols(arr) {
      return arr[0].length || 1;
    };

    // Returns the dimensions of the object { rows: i, cols: j }
    jStat.dimensions = function dimensions(arr) {
      return {
        rows: jStat.rows(arr),
        cols: jStat.cols(arr)
      };
    };

    // Returns a specified row as a vector or return a sub matrix by pick some rows
    jStat.row = function row(arr, index) {
      if (isArray(index)) {
        return index.map(function (i) {
          return jStat.row(arr, i);
        });
      }
      return arr[index];
    };

    // return row as array
    // rowa([[1,2],[3,4]],0) -> [1,2]
    jStat.rowa = function rowa(arr, i) {
      return jStat.row(arr, i);
    };

    // Returns the specified column as a vector or return a sub matrix by pick some
    // columns
    jStat.col = function col(arr, index) {
      if (isArray(index)) {
        var submat = jStat.arange(arr.length).map(function () {
          return new Array(index.length);
        });
        index.forEach(function (ind, i) {
          jStat.arange(arr.length).forEach(function (j) {
            submat[j][i] = arr[j][ind];
          });
        });
        return submat;
      }
      var column = new Array(arr.length);
      for (var i = 0; i < arr.length; i++) column[i] = [arr[i][index]];
      return column;
    };

    // return column as array
    // cola([[1,2],[3,4]],0) -> [1,3]
    jStat.cola = function cola(arr, i) {
      return jStat.col(arr, i).map(function (a) {
        return a[0];
      });
    };

    // Returns the diagonal of the matrix
    jStat.diag = function diag(arr) {
      var nrow = jStat.rows(arr);
      var res = new Array(nrow);
      for (var row = 0; row < nrow; row++) res[row] = [arr[row][row]];
      return res;
    };

    // Returns the anti-diagonal of the matrix
    jStat.antidiag = function antidiag(arr) {
      var nrow = jStat.rows(arr) - 1;
      var res = new Array(nrow);
      for (var i = 0; nrow >= 0; nrow--, i++) res[i] = [arr[i][nrow]];
      return res;
    };

    // Transpose a matrix or array.
    jStat.transpose = function transpose(arr) {
      var obj = [];
      var objArr, rows, cols, j, i;

      // Make sure arr is in matrix format.
      if (!isArray(arr[0])) arr = [arr];
      rows = arr.length;
      cols = arr[0].length;
      for (i = 0; i < cols; i++) {
        objArr = new Array(rows);
        for (j = 0; j < rows; j++) objArr[j] = arr[j][i];
        obj.push(objArr);
      }

      // If obj is vector, return only single array.
      return obj.length === 1 ? obj[0] : obj;
    };

    // Map a function to an array or array of arrays.
    // "toAlter" is an internal variable.
    jStat.map = function map(arr, func, toAlter) {
      var row, nrow, ncol, res, col;
      if (!isArray(arr[0])) arr = [arr];
      nrow = arr.length;
      ncol = arr[0].length;
      res = toAlter ? arr : new Array(nrow);
      for (row = 0; row < nrow; row++) {
        // if the row doesn't exist, create it
        if (!res[row]) res[row] = new Array(ncol);
        for (col = 0; col < ncol; col++) res[row][col] = func(arr[row][col], row, col);
      }
      return res.length === 1 ? res[0] : res;
    };

    // Cumulatively combine the elements of an array or array of arrays using a function.
    jStat.cumreduce = function cumreduce(arr, func, toAlter) {
      var row, nrow, ncol, res, col;
      if (!isArray(arr[0])) arr = [arr];
      nrow = arr.length;
      ncol = arr[0].length;
      res = toAlter ? arr : new Array(nrow);
      for (row = 0; row < nrow; row++) {
        // if the row doesn't exist, create it
        if (!res[row]) res[row] = new Array(ncol);
        if (ncol > 0) res[row][0] = arr[row][0];
        for (col = 1; col < ncol; col++) res[row][col] = func(res[row][col - 1], arr[row][col]);
      }
      return res.length === 1 ? res[0] : res;
    };

    // Destructively alter an array.
    jStat.alter = function alter(arr, func) {
      return jStat.map(arr, func, true);
    };

    // Generate a rows x cols matrix according to the supplied function.
    jStat.create = function create(rows, cols, func) {
      var res = new Array(rows);
      var i, j;
      if (isFunction(cols)) {
        func = cols;
        cols = rows;
      }
      for (i = 0; i < rows; i++) {
        res[i] = new Array(cols);
        for (j = 0; j < cols; j++) res[i][j] = func(i, j);
      }
      return res;
    };
    function retZero() {
      return 0;
    }

    // Generate a rows x cols matrix of zeros.
    jStat.zeros = function zeros(rows, cols) {
      if (!isNumber(cols)) cols = rows;
      return jStat.create(rows, cols, retZero);
    };
    function retOne() {
      return 1;
    }

    // Generate a rows x cols matrix of ones.
    jStat.ones = function ones(rows, cols) {
      if (!isNumber(cols)) cols = rows;
      return jStat.create(rows, cols, retOne);
    };

    // Generate a rows x cols matrix of uniformly random numbers.
    jStat.rand = function rand(rows, cols) {
      if (!isNumber(cols)) cols = rows;
      return jStat.create(rows, cols, jStat._random_fn);
    };
    function retIdent(i, j) {
      return i === j ? 1 : 0;
    }

    // Generate an identity matrix of size row x cols.
    jStat.identity = function identity(rows, cols) {
      if (!isNumber(cols)) cols = rows;
      return jStat.create(rows, cols, retIdent);
    };

    // Tests whether a matrix is symmetric
    jStat.symmetric = function symmetric(arr) {
      var size = arr.length;
      var row, col;
      if (arr.length !== arr[0].length) return false;
      for (row = 0; row < size; row++) {
        for (col = 0; col < size; col++) if (arr[col][row] !== arr[row][col]) return false;
      }
      return true;
    };

    // Set all values to zero.
    jStat.clear = function clear(arr) {
      return jStat.alter(arr, retZero);
    };

    // Generate sequence.
    jStat.seq = function seq(min, max, length, func) {
      if (!isFunction(func)) func = false;
      var arr = [];
      var hival = calcRdx(min, max);
      var step = (max * hival - min * hival) / ((length - 1) * hival);
      var current = min;
      var cnt;

      // Current is assigned using a technique to compensate for IEEE error.
      // TODO: Needs better implementation.
      for (cnt = 0; current <= max && cnt < length; cnt++, current = (min * hival + step * hival * cnt) / hival) {
        arr.push(func ? func(current, cnt) : current);
      }
      return arr;
    };

    // arange(5) -> [0,1,2,3,4]
    // arange(1,5) -> [1,2,3,4]
    // arange(5,1,-1) -> [5,4,3,2]
    jStat.arange = function arange(start, end, step) {
      var rl = [];
      var i;
      step = step || 1;
      if (end === undefined) {
        end = start;
        start = 0;
      }
      if (start === end || step === 0) {
        return [];
      }
      if (start < end && step < 0) {
        return [];
      }
      if (start > end && step > 0) {
        return [];
      }
      if (step > 0) {
        for (i = start; i < end; i += step) {
          rl.push(i);
        }
      } else {
        for (i = start; i > end; i += step) {
          rl.push(i);
        }
      }
      return rl;
    };

    // A=[[1,2,3],[4,5,6],[7,8,9]]
    // slice(A,{row:{end:2},col:{start:1}}) -> [[2,3],[5,6]]
    // slice(A,1,{start:1}) -> [5,6]
    // as numpy code A[:2,1:]
    jStat.slice = function () {
      function _slice(list, start, end, step) {
        // note it's not equal to range.map mode it's a bug
        var i;
        var rl = [];
        var length = list.length;
        if (start === undefined && end === undefined && step === undefined) {
          return jStat.copy(list);
        }
        start = start || 0;
        end = end || list.length;
        start = start >= 0 ? start : length + start;
        end = end >= 0 ? end : length + end;
        step = step || 1;
        if (start === end || step === 0) {
          return [];
        }
        if (start < end && step < 0) {
          return [];
        }
        if (start > end && step > 0) {
          return [];
        }
        if (step > 0) {
          for (i = start; i < end; i += step) {
            rl.push(list[i]);
          }
        } else {
          for (i = start; i > end; i += step) {
            rl.push(list[i]);
          }
        }
        return rl;
      }
      function slice(list, rcSlice) {
        var colSlice, rowSlice;
        rcSlice = rcSlice || {};
        if (isNumber(rcSlice.row)) {
          if (isNumber(rcSlice.col)) return list[rcSlice.row][rcSlice.col];
          var row = jStat.rowa(list, rcSlice.row);
          colSlice = rcSlice.col || {};
          return _slice(row, colSlice.start, colSlice.end, colSlice.step);
        }
        if (isNumber(rcSlice.col)) {
          var col = jStat.cola(list, rcSlice.col);
          rowSlice = rcSlice.row || {};
          return _slice(col, rowSlice.start, rowSlice.end, rowSlice.step);
        }
        rowSlice = rcSlice.row || {};
        colSlice = rcSlice.col || {};
        var rows = _slice(list, rowSlice.start, rowSlice.end, rowSlice.step);
        return rows.map(function (row) {
          return _slice(row, colSlice.start, colSlice.end, colSlice.step);
        });
      }
      return slice;
    }();

    // A=[[1,2,3],[4,5,6],[7,8,9]]
    // sliceAssign(A,{row:{start:1},col:{start:1}},[[0,0],[0,0]])
    // A=[[1,2,3],[4,0,0],[7,0,0]]
    jStat.sliceAssign = function sliceAssign(A, rcSlice, B) {
      var nl, ml;
      if (isNumber(rcSlice.row)) {
        if (isNumber(rcSlice.col)) return A[rcSlice.row][rcSlice.col] = B;
        rcSlice.col = rcSlice.col || {};
        rcSlice.col.start = rcSlice.col.start || 0;
        rcSlice.col.end = rcSlice.col.end || A[0].length;
        rcSlice.col.step = rcSlice.col.step || 1;
        nl = jStat.arange(rcSlice.col.start, Math.min(A.length, rcSlice.col.end), rcSlice.col.step);
        var m = rcSlice.row;
        nl.forEach(function (n, i) {
          A[m][n] = B[i];
        });
        return A;
      }
      if (isNumber(rcSlice.col)) {
        rcSlice.row = rcSlice.row || {};
        rcSlice.row.start = rcSlice.row.start || 0;
        rcSlice.row.end = rcSlice.row.end || A.length;
        rcSlice.row.step = rcSlice.row.step || 1;
        ml = jStat.arange(rcSlice.row.start, Math.min(A[0].length, rcSlice.row.end), rcSlice.row.step);
        var n = rcSlice.col;
        ml.forEach(function (m, j) {
          A[m][n] = B[j];
        });
        return A;
      }
      if (B[0].length === undefined) {
        B = [B];
      }
      rcSlice.row.start = rcSlice.row.start || 0;
      rcSlice.row.end = rcSlice.row.end || A.length;
      rcSlice.row.step = rcSlice.row.step || 1;
      rcSlice.col.start = rcSlice.col.start || 0;
      rcSlice.col.end = rcSlice.col.end || A[0].length;
      rcSlice.col.step = rcSlice.col.step || 1;
      ml = jStat.arange(rcSlice.row.start, Math.min(A.length, rcSlice.row.end), rcSlice.row.step);
      nl = jStat.arange(rcSlice.col.start, Math.min(A[0].length, rcSlice.col.end), rcSlice.col.step);
      ml.forEach(function (m, i) {
        nl.forEach(function (n, j) {
          A[m][n] = B[i][j];
        });
      });
      return A;
    };

    // [1,2,3] ->
    // [[1,0,0],[0,2,0],[0,0,3]]
    jStat.diagonal = function diagonal(diagArray) {
      var mat = jStat.zeros(diagArray.length, diagArray.length);
      diagArray.forEach(function (t, i) {
        mat[i][i] = t;
      });
      return mat;
    };

    // return copy of A
    jStat.copy = function copy(A) {
      return A.map(function (row) {
        if (isNumber(row)) return row;
        return row.map(function (t) {
          return t;
        });
      });
    };

    // TODO: Go over this entire implementation. Seems a tragic waste of resources
    // doing all this work. Instead, and while ugly, use new Function() to generate
    // a custom function for each static method.

    // Quick reference.
    var jProto = jStat.prototype;

    // Default length.
    jProto.length = 0;

    // For internal use only.
    // TODO: Check if they're actually used, and if they are then rename them
    // to _*
    jProto.push = Array.prototype.push;
    jProto.sort = Array.prototype.sort;
    jProto.splice = Array.prototype.splice;
    jProto.slice = Array.prototype.slice;

    // Return a clean array.
    jProto.toArray = function toArray() {
      return this.length > 1 ? slice.call(this) : slice.call(this)[0];
    };

    // Map a function to a matrix or vector.
    jProto.map = function map(func, toAlter) {
      return jStat(jStat.map(this, func, toAlter));
    };

    // Cumulatively combine the elements of a matrix or vector using a function.
    jProto.cumreduce = function cumreduce(func, toAlter) {
      return jStat(jStat.cumreduce(this, func, toAlter));
    };

    // Destructively alter an array.
    jProto.alter = function alter(func) {
      jStat.alter(this, func);
      return this;
    };

    // Extend prototype with methods that have no argument.
    (function (funcs) {
      for (var i = 0; i < funcs.length; i++) (function (passfunc) {
        jProto[passfunc] = function (func) {
          var self = this,
            results;
          // Check for callback.
          if (func) {
            setTimeout(function () {
              func.call(self, jProto[passfunc].call(self));
            });
            return this;
          }
          results = jStat[passfunc](this);
          return isArray(results) ? jStat(results) : results;
        };
      })(funcs[i]);
    })('transpose clear symmetric rows cols dimensions diag antidiag'.split(' '));

    // Extend prototype with methods that have one argument.
    (function (funcs) {
      for (var i = 0; i < funcs.length; i++) (function (passfunc) {
        jProto[passfunc] = function (index, func) {
          var self = this;
          // check for callback
          if (func) {
            setTimeout(function () {
              func.call(self, jProto[passfunc].call(self, index));
            });
            return this;
          }
          return jStat(jStat[passfunc](this, index));
        };
      })(funcs[i]);
    })('row col'.split(' '));

    // Extend prototype with simple shortcut methods.
    (function (funcs) {
      for (var i = 0; i < funcs.length; i++) (function (passfunc) {
        jProto[passfunc] = function () {
          return jStat(jStat[passfunc].apply(null, arguments));
        };
      })(funcs[i]);
    })('create zeros ones rand identity'.split(' '));

    // Exposing jStat.
    return jStat;
  }(Math);
  (function (jStat, Math) {
    var isFunction = jStat.utils.isFunction;

    // Ascending functions for sort
    function ascNum(a, b) {
      return a - b;
    }
    function clip(arg, min, max) {
      return Math.max(min, Math.min(arg, max));
    }

    // sum of an array
    jStat.sum = function sum(arr) {
      var sum = 0;
      var i = arr.length;
      while (--i >= 0) sum += arr[i];
      return sum;
    };

    // sum squared
    jStat.sumsqrd = function sumsqrd(arr) {
      var sum = 0;
      var i = arr.length;
      while (--i >= 0) sum += arr[i] * arr[i];
      return sum;
    };

    // sum of squared errors of prediction (SSE)
    jStat.sumsqerr = function sumsqerr(arr) {
      var mean = jStat.mean(arr);
      var sum = 0;
      var i = arr.length;
      var tmp;
      while (--i >= 0) {
        tmp = arr[i] - mean;
        sum += tmp * tmp;
      }
      return sum;
    };

    // sum of an array in each row
    jStat.sumrow = function sumrow(arr) {
      var sum = 0;
      var i = arr.length;
      while (--i >= 0) sum += arr[i];
      return sum;
    };

    // product of an array
    jStat.product = function product(arr) {
      var prod = 1;
      var i = arr.length;
      while (--i >= 0) prod *= arr[i];
      return prod;
    };

    // minimum value of an array
    jStat.min = function min(arr) {
      var low = arr[0];
      var i = 0;
      while (++i < arr.length) if (arr[i] < low) low = arr[i];
      return low;
    };

    // maximum value of an array
    jStat.max = function max(arr) {
      var high = arr[0];
      var i = 0;
      while (++i < arr.length) if (arr[i] > high) high = arr[i];
      return high;
    };

    // unique values of an array
    jStat.unique = function unique(arr) {
      var hash = {},
        _arr = [];
      for (var i = 0; i < arr.length; i++) {
        if (!hash[arr[i]]) {
          hash[arr[i]] = true;
          _arr.push(arr[i]);
        }
      }
      return _arr;
    };

    // mean value of an array
    jStat.mean = function mean(arr) {
      return jStat.sum(arr) / arr.length;
    };

    // mean squared error (MSE)
    jStat.meansqerr = function meansqerr(arr) {
      return jStat.sumsqerr(arr) / arr.length;
    };

    // geometric mean of an array
    jStat.geomean = function geomean(arr) {
      var logs = arr.map(Math.log);
      var meanOfLogs = jStat.mean(logs);
      return Math.exp(meanOfLogs);
    };

    // median of an array
    jStat.median = function median(arr) {
      var arrlen = arr.length;
      var _arr = arr.slice().sort(ascNum);
      // check if array is even or odd, then return the appropriate
      return !(arrlen & 1) ? (_arr[arrlen / 2 - 1] + _arr[arrlen / 2]) / 2 : _arr[arrlen / 2 | 0];
    };

    // cumulative sum of an array
    jStat.cumsum = function cumsum(arr) {
      return jStat.cumreduce(arr, function (a, b) {
        return a + b;
      });
    };

    // cumulative product of an array
    jStat.cumprod = function cumprod(arr) {
      return jStat.cumreduce(arr, function (a, b) {
        return a * b;
      });
    };

    // successive differences of a sequence
    jStat.diff = function diff(arr) {
      var diffs = [];
      var arrLen = arr.length;
      var i;
      for (i = 1; i < arrLen; i++) diffs.push(arr[i] - arr[i - 1]);
      return diffs;
    };

    // ranks of an array
    jStat.rank = function (arr) {
      var i;
      var distinctNumbers = [];
      var numberCounts = {};
      for (i = 0; i < arr.length; i++) {
        var number = arr[i];
        if (numberCounts[number]) {
          numberCounts[number]++;
        } else {
          numberCounts[number] = 1;
          distinctNumbers.push(number);
        }
      }
      var sortedDistinctNumbers = distinctNumbers.sort(ascNum);
      var numberRanks = {};
      var currentRank = 1;
      for (i = 0; i < sortedDistinctNumbers.length; i++) {
        var number = sortedDistinctNumbers[i];
        var count = numberCounts[number];
        var first = currentRank;
        var last = currentRank + count - 1;
        var rank = (first + last) / 2;
        numberRanks[number] = rank;
        currentRank += count;
      }
      return arr.map(function (number) {
        return numberRanks[number];
      });
    };

    // mode of an array
    // if there are multiple modes of an array, return all of them
    // is this the appropriate way of handling it?
    jStat.mode = function mode(arr) {
      var arrLen = arr.length;
      var _arr = arr.slice().sort(ascNum);
      var count = 1;
      var maxCount = 0;
      var numMaxCount = 0;
      var mode_arr = [];
      var i;
      for (i = 0; i < arrLen; i++) {
        if (_arr[i] === _arr[i + 1]) {
          count++;
        } else {
          if (count > maxCount) {
            mode_arr = [_arr[i]];
            maxCount = count;
            numMaxCount = 0;
          }
          // are there multiple max counts
          else if (count === maxCount) {
            mode_arr.push(_arr[i]);
            numMaxCount++;
          }
          // resetting count for new value in array
          count = 1;
        }
      }
      return numMaxCount === 0 ? mode_arr[0] : mode_arr;
    };

    // range of an array
    jStat.range = function range(arr) {
      return jStat.max(arr) - jStat.min(arr);
    };

    // variance of an array
    // flag = true indicates sample instead of population
    jStat.variance = function variance(arr, flag) {
      return jStat.sumsqerr(arr) / (arr.length - (flag ? 1 : 0));
    };

    // pooled variance of an array of arrays
    jStat.pooledvariance = function pooledvariance(arr) {
      var sumsqerr = arr.reduce(function (a, samples) {
        return a + jStat.sumsqerr(samples);
      }, 0);
      var count = arr.reduce(function (a, samples) {
        return a + samples.length;
      }, 0);
      return sumsqerr / (count - arr.length);
    };

    // deviation of an array
    jStat.deviation = function (arr) {
      var mean = jStat.mean(arr);
      var arrlen = arr.length;
      var dev = new Array(arrlen);
      for (var i = 0; i < arrlen; i++) {
        dev[i] = arr[i] - mean;
      }
      return dev;
    };

    // standard deviation of an array
    // flag = true indicates sample instead of population
    jStat.stdev = function stdev(arr, flag) {
      return Math.sqrt(jStat.variance(arr, flag));
    };

    // pooled standard deviation of an array of arrays
    jStat.pooledstdev = function pooledstdev(arr) {
      return Math.sqrt(jStat.pooledvariance(arr));
    };

    // mean deviation (mean absolute deviation) of an array
    jStat.meandev = function meandev(arr) {
      var mean = jStat.mean(arr);
      var a = [];
      for (var i = arr.length - 1; i >= 0; i--) {
        a.push(Math.abs(arr[i] - mean));
      }
      return jStat.mean(a);
    };

    // median deviation (median absolute deviation) of an array
    jStat.meddev = function meddev(arr) {
      var median = jStat.median(arr);
      var a = [];
      for (var i = arr.length - 1; i >= 0; i--) {
        a.push(Math.abs(arr[i] - median));
      }
      return jStat.median(a);
    };

    // coefficient of variation
    jStat.coeffvar = function coeffvar(arr) {
      return jStat.stdev(arr) / jStat.mean(arr);
    };

    // quartiles of an array
    jStat.quartiles = function quartiles(arr) {
      var arrlen = arr.length;
      var _arr = arr.slice().sort(ascNum);
      return [_arr[Math.round(arrlen / 4) - 1], _arr[Math.round(arrlen / 2) - 1], _arr[Math.round(arrlen * 3 / 4) - 1]];
    };

    // Arbitary quantiles of an array. Direct port of the scipy.stats
    // implementation by Pierre GF Gerard-Marchant.
    jStat.quantiles = function quantiles(arr, quantilesArray, alphap, betap) {
      var sortedArray = arr.slice().sort(ascNum);
      var quantileVals = [quantilesArray.length];
      var n = arr.length;
      var i, p, m, aleph, k, gamma;
      if (typeof alphap === 'undefined') alphap = 3 / 8;
      if (typeof betap === 'undefined') betap = 3 / 8;
      for (i = 0; i < quantilesArray.length; i++) {
        p = quantilesArray[i];
        m = alphap + p * (1 - alphap - betap);
        aleph = n * p + m;
        k = Math.floor(clip(aleph, 1, n - 1));
        gamma = clip(aleph - k, 0, 1);
        quantileVals[i] = (1 - gamma) * sortedArray[k - 1] + gamma * sortedArray[k];
      }
      return quantileVals;
    };

    // Return the k-th percentile of values in a range, where k is in the range 0..1, inclusive.
    // Passing true for the exclusive parameter excludes both endpoints of the range.
    jStat.percentile = function percentile(arr, k, exclusive) {
      var _arr = arr.slice().sort(ascNum);
      var realIndex = k * (_arr.length + (exclusive ? 1 : -1)) + (exclusive ? 0 : 1);
      var index = parseInt(realIndex);
      var frac = realIndex - index;
      if (index + 1 < _arr.length) {
        return _arr[index - 1] + frac * (_arr[index] - _arr[index - 1]);
      } else {
        return _arr[index - 1];
      }
    };

    // The percentile rank of score in a given array. Returns the percentage
    // of all values in the input array that are less than (kind='strict') or
    // less or equal than (kind='weak') score. Default is weak.
    jStat.percentileOfScore = function percentileOfScore(arr, score, kind) {
      var counter = 0;
      var len = arr.length;
      var strict = false;
      var value, i;
      if (kind === 'strict') strict = true;
      for (i = 0; i < len; i++) {
        value = arr[i];
        if (strict && value < score || !strict && value <= score) {
          counter++;
        }
      }
      return counter / len;
    };

    // Histogram (bin count) data
    jStat.histogram = function histogram(arr, binCnt) {
      binCnt = binCnt || 4;
      var first = jStat.min(arr);
      var binWidth = (jStat.max(arr) - first) / binCnt;
      var len = arr.length;
      var bins = [];
      var i;
      for (i = 0; i < binCnt; i++) bins[i] = 0;
      for (i = 0; i < len; i++) bins[Math.min(Math.floor((arr[i] - first) / binWidth), binCnt - 1)] += 1;
      return bins;
    };

    // covariance of two arrays
    jStat.covariance = function covariance(arr1, arr2) {
      var u = jStat.mean(arr1);
      var v = jStat.mean(arr2);
      var arr1Len = arr1.length;
      var sq_dev = new Array(arr1Len);
      var i;
      for (i = 0; i < arr1Len; i++) sq_dev[i] = (arr1[i] - u) * (arr2[i] - v);
      return jStat.sum(sq_dev) / (arr1Len - 1);
    };

    // (pearson's) population correlation coefficient, rho
    jStat.corrcoeff = function corrcoeff(arr1, arr2) {
      return jStat.covariance(arr1, arr2) / jStat.stdev(arr1, 1) / jStat.stdev(arr2, 1);
    };

    // (spearman's) rank correlation coefficient, sp
    jStat.spearmancoeff = function (arr1, arr2) {
      arr1 = jStat.rank(arr1);
      arr2 = jStat.rank(arr2);
      //return pearson's correlation of the ranks:
      return jStat.corrcoeff(arr1, arr2);
    };

    // statistical standardized moments (general form of skew/kurt)
    jStat.stanMoment = function stanMoment(arr, n) {
      var mu = jStat.mean(arr);
      var sigma = jStat.stdev(arr);
      var len = arr.length;
      var skewSum = 0;
      for (var i = 0; i < len; i++) skewSum += Math.pow((arr[i] - mu) / sigma, n);
      return skewSum / arr.length;
    };

    // (pearson's) moment coefficient of skewness
    jStat.skewness = function skewness(arr) {
      return jStat.stanMoment(arr, 3);
    };

    // (pearson's) (excess) kurtosis
    jStat.kurtosis = function kurtosis(arr) {
      return jStat.stanMoment(arr, 4) - 3;
    };
    var jProto = jStat.prototype;

    // Extend jProto with method for calculating cumulative sums and products.
    // This differs from the similar extension below as cumsum and cumprod should
    // not be run again in the case fullbool === true.
    // If a matrix is passed, automatically assume operation should be done on the
    // columns.
    (function (funcs) {
      for (var i = 0; i < funcs.length; i++) (function (passfunc) {
        // If a matrix is passed, automatically assume operation should be done on
        // the columns.
        jProto[passfunc] = function (fullbool, func) {
          var arr = [];
          var i = 0;
          var tmpthis = this;
          // Assignment reassignation depending on how parameters were passed in.
          if (isFunction(fullbool)) {
            func = fullbool;
            fullbool = false;
          }
          // Check if a callback was passed with the function.
          if (func) {
            setTimeout(function () {
              func.call(tmpthis, jProto[passfunc].call(tmpthis, fullbool));
            });
            return this;
          }
          // Check if matrix and run calculations.
          if (this.length > 1) {
            tmpthis = fullbool === true ? this : this.transpose();
            for (; i < tmpthis.length; i++) arr[i] = jStat[passfunc](tmpthis[i]);
            return arr;
          }
          // Pass fullbool if only vector, not a matrix. for variance and stdev.
          return jStat[passfunc](this[0], fullbool);
        };
      })(funcs[i]);
    })('cumsum cumprod'.split(' '));

    // Extend jProto with methods which don't require arguments and work on columns.
    (function (funcs) {
      for (var i = 0; i < funcs.length; i++) (function (passfunc) {
        // If a matrix is passed, automatically assume operation should be done on
        // the columns.
        jProto[passfunc] = function (fullbool, func) {
          var arr = [];
          var i = 0;
          var tmpthis = this;
          // Assignment reassignation depending on how parameters were passed in.
          if (isFunction(fullbool)) {
            func = fullbool;
            fullbool = false;
          }
          // Check if a callback was passed with the function.
          if (func) {
            setTimeout(function () {
              func.call(tmpthis, jProto[passfunc].call(tmpthis, fullbool));
            });
            return this;
          }
          // Check if matrix and run calculations.
          if (this.length > 1) {
            if (passfunc !== 'sumrow') tmpthis = fullbool === true ? this : this.transpose();
            for (; i < tmpthis.length; i++) arr[i] = jStat[passfunc](tmpthis[i]);
            return fullbool === true ? jStat[passfunc](jStat.utils.toVector(arr)) : arr;
          }
          // Pass fullbool if only vector, not a matrix. for variance and stdev.
          return jStat[passfunc](this[0], fullbool);
        };
      })(funcs[i]);
    })(('sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr ' + 'geomean median diff rank mode range variance deviation stdev meandev ' + 'meddev coeffvar quartiles histogram skewness kurtosis').split(' '));

    // Extend jProto with functions that take arguments. Operations on matrices are
    // done on columns.
    (function (funcs) {
      for (var i = 0; i < funcs.length; i++) (function (passfunc) {
        jProto[passfunc] = function () {
          var arr = [];
          var i = 0;
          var tmpthis = this;
          var args = Array.prototype.slice.call(arguments);
          var callbackFunction;

          // If the last argument is a function, we assume it's a callback; we
          // strip the callback out and call the function again.
          if (isFunction(args[args.length - 1])) {
            callbackFunction = args[args.length - 1];
            var argsToPass = args.slice(0, args.length - 1);
            setTimeout(function () {
              callbackFunction.call(tmpthis, jProto[passfunc].apply(tmpthis, argsToPass));
            });
            return this;

            // Otherwise we curry the function args and call normally.
          } else {
            callbackFunction = undefined;
            var curriedFunction = function curriedFunction(vector) {
              return jStat[passfunc].apply(tmpthis, [vector].concat(args));
            };
          }

          // If this is a matrix, run column-by-column.
          if (this.length > 1) {
            tmpthis = tmpthis.transpose();
            for (; i < tmpthis.length; i++) arr[i] = curriedFunction(tmpthis[i]);
            return arr;
          }

          // Otherwise run on the vector.
          return curriedFunction(this[0]);
        };
      })(funcs[i]);
    })('quantiles percentileOfScore'.split(' '));
  })(jStat, Math);
  // Special functions //
  (function (jStat, Math) {
    // Log-gamma function
    jStat.gammaln = function gammaln(x) {
      var j = 0;
      var cof = [76.18009172947146, -86.50532032941677, 24.01409824083091, -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5];
      var ser = 1.000000000190015;
      var xx, y, tmp;
      tmp = (y = xx = x) + 5.5;
      tmp -= (xx + 0.5) * Math.log(tmp);
      for (; j < 6; j++) ser += cof[j] / ++y;
      return Math.log(2.5066282746310005 * ser / xx) - tmp;
    };

    /*
     * log-gamma function to support poisson distribution sampling. The
     * algorithm comes from SPECFUN by Shanjie Zhang and Jianming Jin and their
     * book "Computation of Special Functions", 1996, John Wiley & Sons, Inc.
     */
    jStat.loggam = function loggam(x) {
      var x0, x2, xp, gl, gl0;
      var k, n;
      var a = [8.333333333333333e-02, -2.777777777777778e-03, 7.936507936507937e-04, -5.952380952380952e-04, 8.417508417508418e-04, -1.917526917526918e-03, 6.410256410256410e-03, -2.955065359477124e-02, 1.796443723688307e-01, -1.39243221690590e+00];
      x0 = x;
      n = 0;
      if (x == 1.0 || x == 2.0) {
        return 0.0;
      }
      if (x <= 7.0) {
        n = Math.floor(7 - x);
        x0 = x + n;
      }
      x2 = 1.0 / (x0 * x0);
      xp = 2 * Math.PI;
      gl0 = a[9];
      for (k = 8; k >= 0; k--) {
        gl0 *= x2;
        gl0 += a[k];
      }
      gl = gl0 / x0 + 0.5 * Math.log(xp) + (x0 - 0.5) * Math.log(x0) - x0;
      if (x <= 7.0) {
        for (k = 1; k <= n; k++) {
          gl -= Math.log(x0 - 1.0);
          x0 -= 1.0;
        }
      }
      return gl;
    };

    // gamma of x
    jStat.gammafn = function gammafn(x) {
      var p = [-1.716185138865495, 24.76565080557592, -379.80425647094563, 629.3311553128184, 866.9662027904133, -31451.272968848367, -36144.413418691176, 66456.14382024054];
      var q = [-30.8402300119739, 315.35062697960416, -1015.1563674902192, -3107.771671572311, 22538.118420980151, 4755.8462775278811, -134659.9598649693, -115132.2596755535];
      var fact = false;
      var n = 0;
      var xden = 0;
      var xnum = 0;
      var y = x;
      var i, z, yi, res;
      if (x > 171.6243769536076) {
        return Infinity;
      }
      if (y <= 0) {
        res = y % 1 + 3.6e-16;
        if (res) {
          fact = (!(y & 1) ? 1 : -1) * Math.PI / Math.sin(Math.PI * res);
          y = 1 - y;
        } else {
          return Infinity;
        }
      }
      yi = y;
      if (y < 1) {
        z = y++;
      } else {
        z = (y -= n = (y | 0) - 1) - 1;
      }
      for (i = 0; i < 8; ++i) {
        xnum = (xnum + p[i]) * z;
        xden = xden * z + q[i];
      }
      res = xnum / xden + 1;
      if (yi < y) {
        res /= yi;
      } else if (yi > y) {
        for (i = 0; i < n; ++i) {
          res *= y;
          y++;
        }
      }
      if (fact) {
        res = fact / res;
      }
      return res;
    };

    // lower incomplete gamma function, which is usually typeset with a
    // lower-case greek gamma as the function symbol
    jStat.gammap = function gammap(a, x) {
      return jStat.lowRegGamma(a, x) * jStat.gammafn(a);
    };

    // The lower regularized incomplete gamma function, usually written P(a,x)
    jStat.lowRegGamma = function lowRegGamma(a, x) {
      var aln = jStat.gammaln(a);
      var ap = a;
      var sum = 1 / a;
      var del = sum;
      var b = x + 1 - a;
      var c = 1 / 1.0e-30;
      var d = 1 / b;
      var h = d;
      var i = 1;
      // calculate maximum number of itterations required for a
      var ITMAX = -~(Math.log(a >= 1 ? a : 1 / a) * 8.5 + a * 0.4 + 17);
      var an;
      if (x < 0 || a <= 0) {
        return NaN;
      } else if (x < a + 1) {
        for (; i <= ITMAX; i++) {
          sum += del *= x / ++ap;
        }
        return sum * Math.exp(-x + a * Math.log(x) - aln);
      }
      for (; i <= ITMAX; i++) {
        an = -i * (i - a);
        b += 2;
        d = an * d + b;
        c = b + an / c;
        d = 1 / d;
        h *= d * c;
      }
      return 1 - h * Math.exp(-x + a * Math.log(x) - aln);
    };

    // natural log factorial of n
    jStat.factorialln = function factorialln(n) {
      return n < 0 ? NaN : jStat.gammaln(n + 1);
    };

    // factorial of n
    jStat.factorial = function factorial(n) {
      return n < 0 ? NaN : jStat.gammafn(n + 1);
    };

    // combinations of n, m
    jStat.combination = function combination(n, m) {
      // make sure n or m don't exceed the upper limit of usable values
      return n > 170 || m > 170 ? Math.exp(jStat.combinationln(n, m)) : jStat.factorial(n) / jStat.factorial(m) / jStat.factorial(n - m);
    };
    jStat.combinationln = function combinationln(n, m) {
      return jStat.factorialln(n) - jStat.factorialln(m) - jStat.factorialln(n - m);
    };

    // permutations of n, m
    jStat.permutation = function permutation(n, m) {
      return jStat.factorial(n) / jStat.factorial(n - m);
    };

    // beta function
    jStat.betafn = function betafn(x, y) {
      // ensure arguments are positive
      if (x <= 0 || y <= 0) return undefined;
      // make sure x + y doesn't exceed the upper limit of usable values
      return x + y > 170 ? Math.exp(jStat.betaln(x, y)) : jStat.gammafn(x) * jStat.gammafn(y) / jStat.gammafn(x + y);
    };

    // natural logarithm of beta function
    jStat.betaln = function betaln(x, y) {
      return jStat.gammaln(x) + jStat.gammaln(y) - jStat.gammaln(x + y);
    };

    // Evaluates the continued fraction for incomplete beta function by modified
    // Lentz's method.
    jStat.betacf = function betacf(x, a, b) {
      var fpmin = 1e-30;
      var m = 1;
      var qab = a + b;
      var qap = a + 1;
      var qam = a - 1;
      var c = 1;
      var d = 1 - qab * x / qap;
      var m2, aa, del, h;

      // These q's will be used in factors that occur in the coefficients
      if (Math.abs(d) < fpmin) d = fpmin;
      d = 1 / d;
      h = d;
      for (; m <= 100; m++) {
        m2 = 2 * m;
        aa = m * (b - m) * x / ((qam + m2) * (a + m2));
        // One step (the even one) of the recurrence
        d = 1 + aa * d;
        if (Math.abs(d) < fpmin) d = fpmin;
        c = 1 + aa / c;
        if (Math.abs(c) < fpmin) c = fpmin;
        d = 1 / d;
        h *= d * c;
        aa = -(a + m) * (qab + m) * x / ((a + m2) * (qap + m2));
        // Next step of the recurrence (the odd one)
        d = 1 + aa * d;
        if (Math.abs(d) < fpmin) d = fpmin;
        c = 1 + aa / c;
        if (Math.abs(c) < fpmin) c = fpmin;
        d = 1 / d;
        del = d * c;
        h *= del;
        if (Math.abs(del - 1.0) < 3e-7) break;
      }
      return h;
    };

    // Returns the inverse of the lower regularized inomplete gamma function
    jStat.gammapinv = function gammapinv(p, a) {
      var j = 0;
      var a1 = a - 1;
      var EPS = 1e-8;
      var gln = jStat.gammaln(a);
      var x, err, t, u, pp, lna1, afac;
      if (p >= 1) return Math.max(100, a + 100 * Math.sqrt(a));
      if (p <= 0) return 0;
      if (a > 1) {
        lna1 = Math.log(a1);
        afac = Math.exp(a1 * (lna1 - 1) - gln);
        pp = p < 0.5 ? p : 1 - p;
        t = Math.sqrt(-2 * Math.log(pp));
        x = (2.30753 + t * 0.27061) / (1 + t * (0.99229 + t * 0.04481)) - t;
        if (p < 0.5) x = -x;
        x = Math.max(1e-3, a * Math.pow(1 - 1 / (9 * a) - x / (3 * Math.sqrt(a)), 3));
      } else {
        t = 1 - a * (0.253 + a * 0.12);
        if (p < t) x = Math.pow(p / t, 1 / a);else x = 1 - Math.log(1 - (p - t) / (1 - t));
      }
      for (; j < 12; j++) {
        if (x <= 0) return 0;
        err = jStat.lowRegGamma(a, x) - p;
        if (a > 1) t = afac * Math.exp(-(x - a1) + a1 * (Math.log(x) - lna1));else t = Math.exp(-x + a1 * Math.log(x) - gln);
        u = err / t;
        x -= t = u / (1 - 0.5 * Math.min(1, u * ((a - 1) / x - 1)));
        if (x <= 0) x = 0.5 * (x + t);
        if (Math.abs(t) < EPS * x) break;
      }
      return x;
    };

    // Returns the error function erf(x)
    jStat.erf = function erf(x) {
      var cof = [-1.3026537197817094, 6.4196979235649026e-1, 1.9476473204185836e-2, -9.561514786808631e-3, -9.46595344482036e-4, 3.66839497852761e-4, 4.2523324806907e-5, -2.0278578112534e-5, -1.624290004647e-6, 1.303655835580e-6, 1.5626441722e-8, -8.5238095915e-8, 6.529054439e-9, 5.059343495e-9, -9.91364156e-10, -2.27365122e-10, 9.6467911e-11, 2.394038e-12, -6.886027e-12, 8.94487e-13, 3.13092e-13, -1.12708e-13, 3.81e-16, 7.106e-15, -1.523e-15, -9.4e-17, 1.21e-16, -2.8e-17];
      var j = cof.length - 1;
      var isneg = false;
      var d = 0;
      var dd = 0;
      var t, ty, tmp, res;
      if (x < 0) {
        x = -x;
        isneg = true;
      }
      t = 2 / (2 + x);
      ty = 4 * t - 2;
      for (; j > 0; j--) {
        tmp = d;
        d = ty * d - dd + cof[j];
        dd = tmp;
      }
      res = t * Math.exp(-x * x + 0.5 * (cof[0] + ty * d) - dd);
      return isneg ? res - 1 : 1 - res;
    };

    // Returns the complmentary error function erfc(x)
    jStat.erfc = function erfc(x) {
      return 1 - jStat.erf(x);
    };

    // Returns the inverse of the complementary error function
    jStat.erfcinv = function erfcinv(p) {
      var j = 0;
      var x, err, t, pp;
      if (p >= 2) return -100;
      if (p <= 0) return 100;
      pp = p < 1 ? p : 2 - p;
      t = Math.sqrt(-2 * Math.log(pp / 2));
      x = -0.70711 * ((2.30753 + t * 0.27061) / (1 + t * (0.99229 + t * 0.04481)) - t);
      for (; j < 2; j++) {
        err = jStat.erfc(x) - pp;
        x += err / (1.12837916709551257 * Math.exp(-x * x) - x * err);
      }
      return p < 1 ? x : -x;
    };

    // Returns the inverse of the incomplete beta function
    jStat.ibetainv = function ibetainv(p, a, b) {
      var EPS = 1e-8;
      var a1 = a - 1;
      var b1 = b - 1;
      var j = 0;
      var lna, lnb, pp, t, u, err, x, al, h, w, afac;
      if (p <= 0) return 0;
      if (p >= 1) return 1;
      if (a >= 1 && b >= 1) {
        pp = p < 0.5 ? p : 1 - p;
        t = Math.sqrt(-2 * Math.log(pp));
        x = (2.30753 + t * 0.27061) / (1 + t * (0.99229 + t * 0.04481)) - t;
        if (p < 0.5) x = -x;
        al = (x * x - 3) / 6;
        h = 2 / (1 / (2 * a - 1) + 1 / (2 * b - 1));
        w = x * Math.sqrt(al + h) / h - (1 / (2 * b - 1) - 1 / (2 * a - 1)) * (al + 5 / 6 - 2 / (3 * h));
        x = a / (a + b * Math.exp(2 * w));
      } else {
        lna = Math.log(a / (a + b));
        lnb = Math.log(b / (a + b));
        t = Math.exp(a * lna) / a;
        u = Math.exp(b * lnb) / b;
        w = t + u;
        if (p < t / w) x = Math.pow(a * w * p, 1 / a);else x = 1 - Math.pow(b * w * (1 - p), 1 / b);
      }
      afac = -jStat.gammaln(a) - jStat.gammaln(b) + jStat.gammaln(a + b);
      for (; j < 10; j++) {
        if (x === 0 || x === 1) return x;
        err = jStat.ibeta(x, a, b) - p;
        t = Math.exp(a1 * Math.log(x) + b1 * Math.log(1 - x) + afac);
        u = err / t;
        x -= t = u / (1 - 0.5 * Math.min(1, u * (a1 / x - b1 / (1 - x))));
        if (x <= 0) x = 0.5 * (x + t);
        if (x >= 1) x = 0.5 * (x + t + 1);
        if (Math.abs(t) < EPS * x && j > 0) break;
      }
      return x;
    };

    // Returns the incomplete beta function I_x(a,b)
    jStat.ibeta = function ibeta(x, a, b) {
      // Factors in front of the continued fraction.
      var bt = x === 0 || x === 1 ? 0 : Math.exp(jStat.gammaln(a + b) - jStat.gammaln(a) - jStat.gammaln(b) + a * Math.log(x) + b * Math.log(1 - x));
      if (x < 0 || x > 1) return false;
      if (x < (a + 1) / (a + b + 2))
        // Use continued fraction directly.
        return bt * jStat.betacf(x, a, b) / a;
      // else use continued fraction after making the symmetry transformation.
      return 1 - bt * jStat.betacf(1 - x, b, a) / b;
    };

    // Returns a normal deviate (mu=0, sigma=1).
    // If n and m are specified it returns a object of normal deviates.
    jStat.randn = function randn(n, m) {
      var u, v, x, y, q;
      if (!m) m = n;
      if (n) return jStat.create(n, m, function () {
        return jStat.randn();
      });
      do {
        u = jStat._random_fn();
        v = 1.7156 * (jStat._random_fn() - 0.5);
        x = u - 0.449871;
        y = Math.abs(v) + 0.386595;
        q = x * x + y * (0.19600 * y - 0.25472 * x);
      } while (q > 0.27597 && (q > 0.27846 || v * v > -4 * Math.log(u) * u * u));
      return v / u;
    };

    // Returns a gamma deviate by the method of Marsaglia and Tsang.
    jStat.randg = function randg(shape, n, m) {
      var oalph = shape;
      var a1, a2, u, v, x, mat;
      if (!m) m = n;
      if (!shape) shape = 1;
      if (n) {
        mat = jStat.zeros(n, m);
        mat.alter(function () {
          return jStat.randg(shape);
        });
        return mat;
      }
      if (shape < 1) shape += 1;
      a1 = shape - 1 / 3;
      a2 = 1 / Math.sqrt(9 * a1);
      do {
        do {
          x = jStat.randn();
          v = 1 + a2 * x;
        } while (v <= 0);
        v = v * v * v;
        u = jStat._random_fn();
      } while (u > 1 - 0.331 * Math.pow(x, 4) && Math.log(u) > 0.5 * x * x + a1 * (1 - v + Math.log(v)));
      // alpha > 1
      if (shape == oalph) return a1 * v;
      // alpha < 1
      do {
        u = jStat._random_fn();
      } while (u === 0);
      return Math.pow(u, 1 / oalph) * a1 * v;
    };

    // making use of static methods on the instance
    (function (funcs) {
      for (var i = 0; i < funcs.length; i++) (function (passfunc) {
        jStat.fn[passfunc] = function () {
          return jStat(jStat.map(this, function (value) {
            return jStat[passfunc](value);
          }));
        };
      })(funcs[i]);
    })('gammaln gammafn factorial factorialln'.split(' '));
    (function (funcs) {
      for (var i = 0; i < funcs.length; i++) (function (passfunc) {
        jStat.fn[passfunc] = function () {
          return jStat(jStat[passfunc].apply(null, arguments));
        };
      })(funcs[i]);
    })('randn'.split(' '));
  })(jStat, Math);
  (function (jStat, Math) {
    // generate all distribution instance methods
    (function (list) {
      for (var i = 0; i < list.length; i++) (function (func) {
        // distribution instance method
        jStat[func] = function f(a, b, c) {
          if (!(this instanceof f)) return new f(a, b, c);
          this._a = a;
          this._b = b;
          this._c = c;
          return this;
        };
        // distribution method to be used on a jStat instance
        jStat.fn[func] = function (a, b, c) {
          var newthis = jStat[func](a, b, c);
          newthis.data = this;
          return newthis;
        };
        // sample instance method
        jStat[func].prototype.sample = function (arr) {
          var a = this._a;
          var b = this._b;
          var c = this._c;
          if (arr) return jStat.alter(arr, function () {
            return jStat[func].sample(a, b, c);
          });else return jStat[func].sample(a, b, c);
        };
        // generate the pdf, cdf and inv instance methods
        (function (vals) {
          for (var i = 0; i < vals.length; i++) (function (fnfunc) {
            jStat[func].prototype[fnfunc] = function (x) {
              var a = this._a;
              var b = this._b;
              var c = this._c;
              if (!x && x !== 0) x = this.data;
              if (typeof x !== 'number') {
                return jStat.fn.map.call(x, function (x) {
                  return jStat[func][fnfunc](x, a, b, c);
                });
              }
              return jStat[func][fnfunc](x, a, b, c);
            };
          })(vals[i]);
        })('pdf cdf inv'.split(' '));
        // generate the mean, median, mode and variance instance methods
        (function (vals) {
          for (var i = 0; i < vals.length; i++) (function (fnfunc) {
            jStat[func].prototype[fnfunc] = function () {
              return jStat[func][fnfunc](this._a, this._b, this._c);
            };
          })(vals[i]);
        })('mean median mode variance'.split(' '));
      })(list[i]);
    })(('beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy ' + 'laplace lognormal noncentralt normal pareto studentt weibull uniform ' + 'binomial negbin hypgeom poisson triangular tukey arcsine').split(' '));

    // extend beta function with static methods
    jStat.extend(jStat.beta, {
      pdf: function pdf(x, alpha, beta) {
        // PDF is zero outside the support
        if (x > 1 || x < 0) return 0;
        // PDF is one for the uniform case
        if (alpha == 1 && beta == 1) return 1;
        if (alpha < 512 && beta < 512) {
          return Math.pow(x, alpha - 1) * Math.pow(1 - x, beta - 1) / jStat.betafn(alpha, beta);
        } else {
          return Math.exp((alpha - 1) * Math.log(x) + (beta - 1) * Math.log(1 - x) - jStat.betaln(alpha, beta));
        }
      },
      cdf: function cdf(x, alpha, beta) {
        return x > 1 || x < 0 ? (x > 1) * 1 : jStat.ibeta(x, alpha, beta);
      },
      inv: function inv(x, alpha, beta) {
        return jStat.ibetainv(x, alpha, beta);
      },
      mean: function mean(alpha, beta) {
        return alpha / (alpha + beta);
      },
      median: function median(alpha, beta) {
        return jStat.ibetainv(0.5, alpha, beta);
      },
      mode: function mode(alpha, beta) {
        return (alpha - 1) / (alpha + beta - 2);
      },
      // return a random sample
      sample: function sample(alpha, beta) {
        var u = jStat.randg(alpha);
        return u / (u + jStat.randg(beta));
      },
      variance: function variance(alpha, beta) {
        return alpha * beta / (Math.pow(alpha + beta, 2) * (alpha + beta + 1));
      }
    });

    // extend F function with static methods
    jStat.extend(jStat.centralF, {
      // This implementation of the pdf function avoids float overflow
      // See the way that R calculates this value:
      // https://svn.r-project.org/R/trunk/src/nmath/df.c
      pdf: function pdf(x, df1, df2) {
        var p, q, f;
        if (x < 0) return 0;
        if (df1 <= 2) {
          if (x === 0 && df1 < 2) {
            return Infinity;
          }
          if (x === 0 && df1 === 2) {
            return 1;
          }
          return 1 / jStat.betafn(df1 / 2, df2 / 2) * Math.pow(df1 / df2, df1 / 2) * Math.pow(x, df1 / 2 - 1) * Math.pow(1 + df1 / df2 * x, -(df1 + df2) / 2);
        }
        p = df1 * x / (df2 + x * df1);
        q = df2 / (df2 + x * df1);
        f = df1 * q / 2.0;
        return f * jStat.binomial.pdf((df1 - 2) / 2, (df1 + df2 - 2) / 2, p);
      },
      cdf: function cdf(x, df1, df2) {
        if (x < 0) return 0;
        return jStat.ibeta(df1 * x / (df1 * x + df2), df1 / 2, df2 / 2);
      },
      inv: function inv(x, df1, df2) {
        return df2 / (df1 * (1 / jStat.ibetainv(x, df1 / 2, df2 / 2) - 1));
      },
      mean: function mean(df1, df2) {
        return df2 > 2 ? df2 / (df2 - 2) : undefined;
      },
      mode: function mode(df1, df2) {
        return df1 > 2 ? df2 * (df1 - 2) / (df1 * (df2 + 2)) : undefined;
      },
      // return a random sample
      sample: function sample(df1, df2) {
        var x1 = jStat.randg(df1 / 2) * 2;
        var x2 = jStat.randg(df2 / 2) * 2;
        return x1 / df1 / (x2 / df2);
      },
      variance: function variance(df1, df2) {
        if (df2 <= 4) return undefined;
        return 2 * df2 * df2 * (df1 + df2 - 2) / (df1 * (df2 - 2) * (df2 - 2) * (df2 - 4));
      }
    });

    // extend cauchy function with static methods
    jStat.extend(jStat.cauchy, {
      pdf: function pdf(x, local, scale) {
        if (scale < 0) {
          return 0;
        }
        return scale / (Math.pow(x - local, 2) + Math.pow(scale, 2)) / Math.PI;
      },
      cdf: function cdf(x, local, scale) {
        return Math.atan((x - local) / scale) / Math.PI + 0.5;
      },
      inv: function (p, local, scale) {
        return local + scale * Math.tan(Math.PI * (p - 0.5));
      },
      median: function median(local /*, scale*/) {
        return local;
      },
      mode: function mode(local /*, scale*/) {
        return local;
      },
      sample: function sample(local, scale) {
        return jStat.randn() * Math.sqrt(1 / (2 * jStat.randg(0.5))) * scale + local;
      }
    });

    // extend chisquare function with static methods
    jStat.extend(jStat.chisquare, {
      pdf: function pdf(x, dof) {
        if (x < 0) return 0;
        return x === 0 && dof === 2 ? 0.5 : Math.exp((dof / 2 - 1) * Math.log(x) - x / 2 - dof / 2 * Math.log(2) - jStat.gammaln(dof / 2));
      },
      cdf: function cdf(x, dof) {
        if (x < 0) return 0;
        return jStat.lowRegGamma(dof / 2, x / 2);
      },
      inv: function (p, dof) {
        return 2 * jStat.gammapinv(p, 0.5 * dof);
      },
      mean: function (dof) {
        return dof;
      },
      // TODO: this is an approximation (is there a better way?)
      median: function median(dof) {
        return dof * Math.pow(1 - 2 / (9 * dof), 3);
      },
      mode: function mode(dof) {
        return dof - 2 > 0 ? dof - 2 : 0;
      },
      sample: function sample(dof) {
        return jStat.randg(dof / 2) * 2;
      },
      variance: function variance(dof) {
        return 2 * dof;
      }
    });

    // extend exponential function with static methods
    jStat.extend(jStat.exponential, {
      pdf: function pdf(x, rate) {
        return x < 0 ? 0 : rate * Math.exp(-rate * x);
      },
      cdf: function cdf(x, rate) {
        return x < 0 ? 0 : 1 - Math.exp(-rate * x);
      },
      inv: function (p, rate) {
        return -Math.log(1 - p) / rate;
      },
      mean: function (rate) {
        return 1 / rate;
      },
      median: function (rate) {
        return 1 / rate * Math.log(2);
      },
      mode: function mode( /*rate*/
      ) {
        return 0;
      },
      sample: function sample(rate) {
        return -1 / rate * Math.log(jStat._random_fn());
      },
      variance: function (rate) {
        return Math.pow(rate, -2);
      }
    });

    // extend gamma function with static methods
    jStat.extend(jStat.gamma, {
      pdf: function pdf(x, shape, scale) {
        if (x < 0) return 0;
        return x === 0 && shape === 1 ? 1 / scale : Math.exp((shape - 1) * Math.log(x) - x / scale - jStat.gammaln(shape) - shape * Math.log(scale));
      },
      cdf: function cdf(x, shape, scale) {
        if (x < 0) return 0;
        return jStat.lowRegGamma(shape, x / scale);
      },
      inv: function (p, shape, scale) {
        return jStat.gammapinv(p, shape) * scale;
      },
      mean: function (shape, scale) {
        return shape * scale;
      },
      mode: function mode(shape, scale) {
        if (shape > 1) return (shape - 1) * scale;
        return undefined;
      },
      sample: function sample(shape, scale) {
        return jStat.randg(shape) * scale;
      },
      variance: function variance(shape, scale) {
        return shape * scale * scale;
      }
    });

    // extend inverse gamma function with static methods
    jStat.extend(jStat.invgamma, {
      pdf: function pdf(x, shape, scale) {
        if (x <= 0) return 0;
        return Math.exp(-(shape + 1) * Math.log(x) - scale / x - jStat.gammaln(shape) + shape * Math.log(scale));
      },
      cdf: function cdf(x, shape, scale) {
        if (x <= 0) return 0;
        return 1 - jStat.lowRegGamma(shape, scale / x);
      },
      inv: function (p, shape, scale) {
        return scale / jStat.gammapinv(1 - p, shape);
      },
      mean: function (shape, scale) {
        return shape > 1 ? scale / (shape - 1) : undefined;
      },
      mode: function mode(shape, scale) {
        return scale / (shape + 1);
      },
      sample: function sample(shape, scale) {
        return scale / jStat.randg(shape);
      },
      variance: function variance(shape, scale) {
        if (shape <= 2) return undefined;
        return scale * scale / ((shape - 1) * (shape - 1) * (shape - 2));
      }
    });

    // extend kumaraswamy function with static methods
    jStat.extend(jStat.kumaraswamy, {
      pdf: function pdf(x, alpha, beta) {
        if (x === 0 && alpha === 1) return beta;else if (x === 1 && beta === 1) return alpha;
        return Math.exp(Math.log(alpha) + Math.log(beta) + (alpha - 1) * Math.log(x) + (beta - 1) * Math.log(1 - Math.pow(x, alpha)));
      },
      cdf: function cdf(x, alpha, beta) {
        if (x < 0) return 0;else if (x > 1) return 1;
        return 1 - Math.pow(1 - Math.pow(x, alpha), beta);
      },
      inv: function inv(p, alpha, beta) {
        return Math.pow(1 - Math.pow(1 - p, 1 / beta), 1 / alpha);
      },
      mean: function (alpha, beta) {
        return beta * jStat.gammafn(1 + 1 / alpha) * jStat.gammafn(beta) / jStat.gammafn(1 + 1 / alpha + beta);
      },
      median: function median(alpha, beta) {
        return Math.pow(1 - Math.pow(2, -1 / beta), 1 / alpha);
      },
      mode: function mode(alpha, beta) {
        if (!(alpha >= 1 && beta >= 1 && alpha !== 1 && beta !== 1)) return undefined;
        return Math.pow((alpha - 1) / (alpha * beta - 1), 1 / alpha);
      },
      variance: function variance( /*alpha, beta*/
      ) {
        throw new Error('variance not yet implemented');
        // TODO: complete this
      }
    });

    // extend lognormal function with static methods
    jStat.extend(jStat.lognormal, {
      pdf: function pdf(x, mu, sigma) {
        if (x <= 0) return 0;
        return Math.exp(-Math.log(x) - 0.5 * Math.log(2 * Math.PI) - Math.log(sigma) - Math.pow(Math.log(x) - mu, 2) / (2 * sigma * sigma));
      },
      cdf: function cdf(x, mu, sigma) {
        if (x < 0) return 0;
        return 0.5 + 0.5 * jStat.erf((Math.log(x) - mu) / Math.sqrt(2 * sigma * sigma));
      },
      inv: function (p, mu, sigma) {
        return Math.exp(-1.41421356237309505 * sigma * jStat.erfcinv(2 * p) + mu);
      },
      mean: function mean(mu, sigma) {
        return Math.exp(mu + sigma * sigma / 2);
      },
      median: function median(mu /*, sigma*/) {
        return Math.exp(mu);
      },
      mode: function mode(mu, sigma) {
        return Math.exp(mu - sigma * sigma);
      },
      sample: function sample(mu, sigma) {
        return Math.exp(jStat.randn() * sigma + mu);
      },
      variance: function variance(mu, sigma) {
        return (Math.exp(sigma * sigma) - 1) * Math.exp(2 * mu + sigma * sigma);
      }
    });

    // extend noncentralt function with static methods
    jStat.extend(jStat.noncentralt, {
      pdf: function pdf(x, dof, ncp) {
        var tol = 1e-14;
        if (Math.abs(ncp) < tol)
          // ncp approx 0; use student-t
          return jStat.studentt.pdf(x, dof);
        if (Math.abs(x) < tol) {
          // different formula for x == 0
          return Math.exp(jStat.gammaln((dof + 1) / 2) - ncp * ncp / 2 - 0.5 * Math.log(Math.PI * dof) - jStat.gammaln(dof / 2));
        }

        // formula for x != 0
        return dof / x * (jStat.noncentralt.cdf(x * Math.sqrt(1 + 2 / dof), dof + 2, ncp) - jStat.noncentralt.cdf(x, dof, ncp));
      },
      cdf: function cdf(x, dof, ncp) {
        var tol = 1e-14;
        var min_iterations = 200;
        if (Math.abs(ncp) < tol)
          // ncp approx 0; use student-t
          return jStat.studentt.cdf(x, dof);

        // turn negative x into positive and flip result afterwards
        var flip = false;
        if (x < 0) {
          flip = true;
          ncp = -ncp;
        }
        var prob = jStat.normal.cdf(-ncp, 0, 1);
        var value = tol + 1;
        // use value at last two steps to determine convergence
        var lastvalue = value;
        var y = x * x / (x * x + dof);
        var j = 0;
        var p = Math.exp(-ncp * ncp / 2);
        var q = Math.exp(-ncp * ncp / 2 - 0.5 * Math.log(2) - jStat.gammaln(3 / 2)) * ncp;
        while (j < min_iterations || lastvalue > tol || value > tol) {
          lastvalue = value;
          if (j > 0) {
            p *= ncp * ncp / (2 * j);
            q *= ncp * ncp / (2 * (j + 1 / 2));
          }
          value = p * jStat.beta.cdf(y, j + 0.5, dof / 2) + q * jStat.beta.cdf(y, j + 1, dof / 2);
          prob += 0.5 * value;
          j++;
        }
        return flip ? 1 - prob : prob;
      }
    });

    // extend normal function with static methods
    jStat.extend(jStat.normal, {
      pdf: function pdf(x, mean, std) {
        return Math.exp(-0.5 * Math.log(2 * Math.PI) - Math.log(std) - Math.pow(x - mean, 2) / (2 * std * std));
      },
      cdf: function cdf(x, mean, std) {
        return 0.5 * (1 + jStat.erf((x - mean) / Math.sqrt(2 * std * std)));
      },
      inv: function (p, mean, std) {
        return -1.41421356237309505 * std * jStat.erfcinv(2 * p) + mean;
      },
      mean: function (mean /*, std*/) {
        return mean;
      },
      median: function median(mean /*, std*/) {
        return mean;
      },
      mode: function (mean /*, std*/) {
        return mean;
      },
      sample: function sample(mean, std) {
        return jStat.randn() * std + mean;
      },
      variance: function (mean, std) {
        return std * std;
      }
    });

    // extend pareto function with static methods
    jStat.extend(jStat.pareto, {
      pdf: function pdf(x, scale, shape) {
        if (x < scale) return 0;
        return shape * Math.pow(scale, shape) / Math.pow(x, shape + 1);
      },
      cdf: function cdf(x, scale, shape) {
        if (x < scale) return 0;
        return 1 - Math.pow(scale / x, shape);
      },
      inv: function inv(p, scale, shape) {
        return scale / Math.pow(1 - p, 1 / shape);
      },
      mean: function mean(scale, shape) {
        if (shape <= 1) return undefined;
        return shape * Math.pow(scale, shape) / (shape - 1);
      },
      median: function median(scale, shape) {
        return scale * (shape * Math.SQRT2);
      },
      mode: function mode(scale /*, shape*/) {
        return scale;
      },
      variance: function (scale, shape) {
        if (shape <= 2) return undefined;
        return scale * scale * shape / (Math.pow(shape - 1, 2) * (shape - 2));
      }
    });

    // extend studentt function with static methods
    jStat.extend(jStat.studentt, {
      pdf: function pdf(x, dof) {
        dof = dof > 1e100 ? 1e100 : dof;
        return 1 / (Math.sqrt(dof) * jStat.betafn(0.5, dof / 2)) * Math.pow(1 + x * x / dof, -((dof + 1) / 2));
      },
      cdf: function cdf(x, dof) {
        var dof2 = dof / 2;
        return jStat.ibeta((x + Math.sqrt(x * x + dof)) / (2 * Math.sqrt(x * x + dof)), dof2, dof2);
      },
      inv: function (p, dof) {
        var x = jStat.ibetainv(2 * Math.min(p, 1 - p), 0.5 * dof, 0.5);
        x = Math.sqrt(dof * (1 - x) / x);
        return p > 0.5 ? x : -x;
      },
      mean: function mean(dof) {
        return dof > 1 ? 0 : undefined;
      },
      median: function median( /*dof*/
      ) {
        return 0;
      },
      mode: function mode( /*dof*/
      ) {
        return 0;
      },
      sample: function sample(dof) {
        return jStat.randn() * Math.sqrt(dof / (2 * jStat.randg(dof / 2)));
      },
      variance: function variance(dof) {
        return dof > 2 ? dof / (dof - 2) : dof > 1 ? Infinity : undefined;
      }
    });

    // extend weibull function with static methods
    jStat.extend(jStat.weibull, {
      pdf: function pdf(x, scale, shape) {
        if (x < 0 || scale < 0 || shape < 0) return 0;
        return shape / scale * Math.pow(x / scale, shape - 1) * Math.exp(-Math.pow(x / scale, shape));
      },
      cdf: function cdf(x, scale, shape) {
        return x < 0 ? 0 : 1 - Math.exp(-Math.pow(x / scale, shape));
      },
      inv: function (p, scale, shape) {
        return scale * Math.pow(-Math.log(1 - p), 1 / shape);
      },
      mean: function (scale, shape) {
        return scale * jStat.gammafn(1 + 1 / shape);
      },
      median: function median(scale, shape) {
        return scale * Math.pow(Math.log(2), 1 / shape);
      },
      mode: function mode(scale, shape) {
        if (shape <= 1) return 0;
        return scale * Math.pow((shape - 1) / shape, 1 / shape);
      },
      sample: function sample(scale, shape) {
        return scale * Math.pow(-Math.log(jStat._random_fn()), 1 / shape);
      },
      variance: function variance(scale, shape) {
        return scale * scale * jStat.gammafn(1 + 2 / shape) - Math.pow(jStat.weibull.mean(scale, shape), 2);
      }
    });

    // extend uniform function with static methods
    jStat.extend(jStat.uniform, {
      pdf: function pdf(x, a, b) {
        return x < a || x > b ? 0 : 1 / (b - a);
      },
      cdf: function cdf(x, a, b) {
        if (x < a) return 0;else if (x < b) return (x - a) / (b - a);
        return 1;
      },
      inv: function (p, a, b) {
        return a + p * (b - a);
      },
      mean: function mean(a, b) {
        return 0.5 * (a + b);
      },
      median: function median(a, b) {
        return jStat.mean(a, b);
      },
      mode: function mode( /*a, b*/
      ) {
        throw new Error('mode is not yet implemented');
      },
      sample: function sample(a, b) {
        return a / 2 + b / 2 + (b / 2 - a / 2) * (2 * jStat._random_fn() - 1);
      },
      variance: function variance(a, b) {
        return Math.pow(b - a, 2) / 12;
      }
    });

    // Got this from http://www.math.ucla.edu/~tom/distributions/binomial.html
    function betinc(x, a, b, eps) {
      var a0 = 0;
      var b0 = 1;
      var a1 = 1;
      var b1 = 1;
      var m9 = 0;
      var a2 = 0;
      var c9;
      while (Math.abs((a1 - a2) / a1) > eps) {
        a2 = a1;
        c9 = -(a + m9) * (a + b + m9) * x / (a + 2 * m9) / (a + 2 * m9 + 1);
        a0 = a1 + c9 * a0;
        b0 = b1 + c9 * b0;
        m9 = m9 + 1;
        c9 = m9 * (b - m9) * x / (a + 2 * m9 - 1) / (a + 2 * m9);
        a1 = a0 + c9 * a1;
        b1 = b0 + c9 * b1;
        a0 = a0 / b1;
        b0 = b0 / b1;
        a1 = a1 / b1;
        b1 = 1;
      }
      return a1 / a;
    }

    // extend uniform function with static methods
    jStat.extend(jStat.binomial, {
      pdf: function pdf(k, n, p) {
        return p === 0 || p === 1 ? n * p === k ? 1 : 0 : jStat.combination(n, k) * Math.pow(p, k) * Math.pow(1 - p, n - k);
      },
      cdf: function cdf(x, n, p) {
        var betacdf;
        var eps = 1e-10;
        if (x < 0) return 0;
        if (x >= n) return 1;
        if (p < 0 || p > 1 || n <= 0) return NaN;
        x = Math.floor(x);
        var z = p;
        var a = x + 1;
        var b = n - x;
        var s = a + b;
        var bt = Math.exp(jStat.gammaln(s) - jStat.gammaln(b) - jStat.gammaln(a) + a * Math.log(z) + b * Math.log(1 - z));
        if (z < (a + 1) / (s + 2)) betacdf = bt * betinc(z, a, b, eps);else betacdf = 1 - bt * betinc(1 - z, b, a, eps);
        return Math.round((1 - betacdf) * (1 / eps)) / (1 / eps);
      }
    });

    // extend uniform function with static methods
    jStat.extend(jStat.negbin, {
      pdf: function pdf(k, r, p) {
        if (k !== k >>> 0) return false;
        if (k < 0) return 0;
        return jStat.combination(k + r - 1, r - 1) * Math.pow(1 - p, k) * Math.pow(p, r);
      },
      cdf: function cdf(x, r, p) {
        var sum = 0,
          k = 0;
        if (x < 0) return 0;
        for (; k <= x; k++) {
          sum += jStat.negbin.pdf(k, r, p);
        }
        return sum;
      }
    });

    // extend uniform function with static methods
    jStat.extend(jStat.hypgeom, {
      pdf: function pdf(k, N, m, n) {
        // Hypergeometric PDF.

        // A simplification of the CDF algorithm below.

        // k = number of successes drawn
        // N = population size
        // m = number of successes in population
        // n = number of items drawn from population

        if (k !== k | 0) {
          return false;
        } else if (k < 0 || k < m - (N - n)) {
          // It's impossible to have this few successes drawn.
          return 0;
        } else if (k > n || k > m) {
          // It's impossible to have this many successes drawn.
          return 0;
        } else if (m * 2 > N) {
          // More than half the population is successes.

          if (n * 2 > N) {
            // More than half the population is sampled.

            return jStat.hypgeom.pdf(N - m - n + k, N, N - m, N - n);
          } else {
            // Half or less of the population is sampled.

            return jStat.hypgeom.pdf(n - k, N, N - m, n);
          }
        } else if (n * 2 > N) {
          // Half or less is successes.

          return jStat.hypgeom.pdf(m - k, N, m, N - n);
        } else if (m < n) {
          // We want to have the number of things sampled to be less than the
          // successes available. So swap the definitions of successful and sampled.
          return jStat.hypgeom.pdf(k, N, n, m);
        } else {
          // If we get here, half or less of the population was sampled, half or
          // less of it was successes, and we had fewer sampled things than
          // successes. Now we can do this complicated iterative algorithm in an
          // efficient way.

          // The basic premise of the algorithm is that we partially normalize our
          // intermediate product to keep it in a numerically good region, and then
          // finish the normalization at the end.

          // This variable holds the scaled probability of the current number of
          // successes.
          var scaledPDF = 1;

          // This keeps track of how much we have normalized.
          var samplesDone = 0;
          for (var i = 0; i < k; i++) {
            // For every possible number of successes up to that observed...

            while (scaledPDF > 1 && samplesDone < n) {
              // Intermediate result is growing too big. Apply some of the
              // normalization to shrink everything.

              scaledPDF *= 1 - m / (N - samplesDone);

              // Say we've normalized by this sample already.
              samplesDone++;
            }

            // Work out the partially-normalized hypergeometric PDF for the next
            // number of successes
            scaledPDF *= (n - i) * (m - i) / ((i + 1) * (N - m - n + i + 1));
          }
          for (; samplesDone < n; samplesDone++) {
            // Apply all the rest of the normalization
            scaledPDF *= 1 - m / (N - samplesDone);
          }

          // Bound answer sanely before returning.
          return Math.min(1, Math.max(0, scaledPDF));
        }
      },
      cdf: function cdf(x, N, m, n) {
        // Hypergeometric CDF.

        // This algorithm is due to Prof. Thomas S. Ferguson, <tom@math.ucla.edu>,
        // and comes from his hypergeometric test calculator at
        // <http://www.math.ucla.edu/~tom/distributions/Hypergeometric.html>.

        // x = number of successes drawn
        // N = population size
        // m = number of successes in population
        // n = number of items drawn from population

        if (x < 0 || x < m - (N - n)) {
          // It's impossible to have this few successes drawn or fewer.
          return 0;
        } else if (x >= n || x >= m) {
          // We will always have this many successes or fewer.
          return 1;
        } else if (m * 2 > N) {
          // More than half the population is successes.

          if (n * 2 > N) {
            // More than half the population is sampled.

            return jStat.hypgeom.cdf(N - m - n + x, N, N - m, N - n);
          } else {
            // Half or less of the population is sampled.

            return 1 - jStat.hypgeom.cdf(n - x - 1, N, N - m, n);
          }
        } else if (n * 2 > N) {
          // Half or less is successes.

          return 1 - jStat.hypgeom.cdf(m - x - 1, N, m, N - n);
        } else if (m < n) {
          // We want to have the number of things sampled to be less than the
          // successes available. So swap the definitions of successful and sampled.
          return jStat.hypgeom.cdf(x, N, n, m);
        } else {
          // If we get here, half or less of the population was sampled, half or
          // less of it was successes, and we had fewer sampled things than
          // successes. Now we can do this complicated iterative algorithm in an
          // efficient way.

          // The basic premise of the algorithm is that we partially normalize our
          // intermediate sum to keep it in a numerically good region, and then
          // finish the normalization at the end.

          // Holds the intermediate, scaled total CDF.
          var scaledCDF = 1;

          // This variable holds the scaled probability of the current number of
          // successes.
          var scaledPDF = 1;

          // This keeps track of how much we have normalized.
          var samplesDone = 0;
          for (var i = 0; i < x; i++) {
            // For every possible number of successes up to that observed...

            while (scaledCDF > 1 && samplesDone < n) {
              // Intermediate result is growing too big. Apply some of the
              // normalization to shrink everything.

              var factor = 1 - m / (N - samplesDone);
              scaledPDF *= factor;
              scaledCDF *= factor;

              // Say we've normalized by this sample already.
              samplesDone++;
            }

            // Work out the partially-normalized hypergeometric PDF for the next
            // number of successes
            scaledPDF *= (n - i) * (m - i) / ((i + 1) * (N - m - n + i + 1));

            // Add to the CDF answer.
            scaledCDF += scaledPDF;
          }
          for (; samplesDone < n; samplesDone++) {
            // Apply all the rest of the normalization
            scaledCDF *= 1 - m / (N - samplesDone);
          }

          // Bound answer sanely before returning.
          return Math.min(1, Math.max(0, scaledCDF));
        }
      }
    });

    // extend uniform function with static methods
    jStat.extend(jStat.poisson, {
      pdf: function pdf(k, l) {
        if (l < 0 || k % 1 !== 0 || k < 0) {
          return 0;
        }
        return Math.pow(l, k) * Math.exp(-l) / jStat.factorial(k);
      },
      cdf: function cdf(x, l) {
        var sumarr = [],
          k = 0;
        if (x < 0) return 0;
        for (; k <= x; k++) {
          sumarr.push(jStat.poisson.pdf(k, l));
        }
        return jStat.sum(sumarr);
      },
      mean: function (l) {
        return l;
      },
      variance: function (l) {
        return l;
      },
      sampleSmall: function sampleSmall(l) {
        var p = 1,
          k = 0,
          L = Math.exp(-l);
        do {
          k++;
          p *= jStat._random_fn();
        } while (p > L);
        return k - 1;
      },
      sampleLarge: function sampleLarge(l) {
        var lam = l;
        var k;
        var U, V, slam, loglam, a, b, invalpha, vr, us;
        slam = Math.sqrt(lam);
        loglam = Math.log(lam);
        b = 0.931 + 2.53 * slam;
        a = -0.059 + 0.02483 * b;
        invalpha = 1.1239 + 1.1328 / (b - 3.4);
        vr = 0.9277 - 3.6224 / (b - 2);
        while (1) {
          U = Math.random() - 0.5;
          V = Math.random();
          us = 0.5 - Math.abs(U);
          k = Math.floor((2 * a / us + b) * U + lam + 0.43);
          if (us >= 0.07 && V <= vr) {
            return k;
          }
          if (k < 0 || us < 0.013 && V > us) {
            continue;
          }
          /* log(V) == log(0.0) ok here */
          /* if U==0.0 so that us==0.0, log is ok since always returns */
          if (Math.log(V) + Math.log(invalpha) - Math.log(a / (us * us) + b) <= -lam + k * loglam - jStat.loggam(k + 1)) {
            return k;
          }
        }
      },
      sample: function sample(l) {
        if (l < 10) return this.sampleSmall(l);else return this.sampleLarge(l);
      }
    });

    // extend triangular function with static methods
    jStat.extend(jStat.triangular, {
      pdf: function pdf(x, a, b, c) {
        if (b <= a || c < a || c > b) {
          return NaN;
        } else {
          if (x < a || x > b) {
            return 0;
          } else if (x < c) {
            return 2 * (x - a) / ((b - a) * (c - a));
          } else if (x === c) {
            return 2 / (b - a);
          } else {
            // x > c
            return 2 * (b - x) / ((b - a) * (b - c));
          }
        }
      },
      cdf: function cdf(x, a, b, c) {
        if (b <= a || c < a || c > b) return NaN;
        if (x <= a) return 0;else if (x >= b) return 1;
        if (x <= c) return Math.pow(x - a, 2) / ((b - a) * (c - a));else
          // x > c
          return 1 - Math.pow(b - x, 2) / ((b - a) * (b - c));
      },
      inv: function inv(p, a, b, c) {
        if (b <= a || c < a || c > b) {
          return NaN;
        } else {
          if (p <= (c - a) / (b - a)) {
            return a + (b - a) * Math.sqrt(p * ((c - a) / (b - a)));
          } else {
            // p > ((c - a) / (b - a))
            return a + (b - a) * (1 - Math.sqrt((1 - p) * (1 - (c - a) / (b - a))));
          }
        }
      },
      mean: function mean(a, b, c) {
        return (a + b + c) / 3;
      },
      median: function median(a, b, c) {
        if (c <= (a + b) / 2) {
          return b - Math.sqrt((b - a) * (b - c)) / Math.sqrt(2);
        } else if (c > (a + b) / 2) {
          return a + Math.sqrt((b - a) * (c - a)) / Math.sqrt(2);
        }
      },
      mode: function mode(a, b, c) {
        return c;
      },
      sample: function sample(a, b, c) {
        var u = jStat._random_fn();
        if (u < (c - a) / (b - a)) return a + Math.sqrt(u * (b - a) * (c - a));
        return b - Math.sqrt((1 - u) * (b - a) * (b - c));
      },
      variance: function variance(a, b, c) {
        return (a * a + b * b + c * c - a * b - a * c - b * c) / 18;
      }
    });

    // extend arcsine function with static methods
    jStat.extend(jStat.arcsine, {
      pdf: function pdf(x, a, b) {
        if (b <= a) return NaN;
        return x <= a || x >= b ? 0 : 2 / Math.PI * Math.pow(Math.pow(b - a, 2) - Math.pow(2 * x - a - b, 2), -0.5);
      },
      cdf: function cdf(x, a, b) {
        if (x < a) return 0;else if (x < b) return 2 / Math.PI * Math.asin(Math.sqrt((x - a) / (b - a)));
        return 1;
      },
      inv: function (p, a, b) {
        return a + (0.5 - 0.5 * Math.cos(Math.PI * p)) * (b - a);
      },
      mean: function mean(a, b) {
        if (b <= a) return NaN;
        return (a + b) / 2;
      },
      median: function median(a, b) {
        if (b <= a) return NaN;
        return (a + b) / 2;
      },
      mode: function mode( /*a, b*/
      ) {
        throw new Error('mode is not yet implemented');
      },
      sample: function sample(a, b) {
        return (a + b) / 2 + (b - a) / 2 * Math.sin(2 * Math.PI * jStat.uniform.sample(0, 1));
      },
      variance: function variance(a, b) {
        if (b <= a) return NaN;
        return Math.pow(b - a, 2) / 8;
      }
    });
    function laplaceSign(x) {
      return x / Math.abs(x);
    }
    jStat.extend(jStat.laplace, {
      pdf: function pdf(x, mu, b) {
        return b <= 0 ? 0 : Math.exp(-Math.abs(x - mu) / b) / (2 * b);
      },
      cdf: function cdf(x, mu, b) {
        if (b <= 0) {
          return 0;
        }
        if (x < mu) {
          return 0.5 * Math.exp((x - mu) / b);
        } else {
          return 1 - 0.5 * Math.exp(-(x - mu) / b);
        }
      },
      mean: function (mu /*, b*/) {
        return mu;
      },
      median: function (mu /*, b*/) {
        return mu;
      },
      mode: function (mu /*, b*/) {
        return mu;
      },
      variance: function (mu, b) {
        return 2 * b * b;
      },
      sample: function sample(mu, b) {
        var u = jStat._random_fn() - 0.5;
        return mu - b * laplaceSign(u) * Math.log(1 - 2 * Math.abs(u));
      }
    });
    function tukeyWprob(w, rr, cc) {
      var nleg = 12;
      var ihalf = 6;
      var C1 = -30;
      var C2 = -50;
      var C3 = 60;
      var bb = 8;
      var wlar = 3;
      var wincr1 = 2;
      var wincr2 = 3;
      var xleg = [0.981560634246719250690549090149, 0.904117256370474856678465866119, 0.769902674194304687036893833213, 0.587317954286617447296702418941, 0.367831498998180193752691536644, 0.125233408511468915472441369464];
      var aleg = [0.047175336386511827194615961485, 0.106939325995318430960254718194, 0.160078328543346226334652529543, 0.203167426723065921749064455810, 0.233492536538354808760849898925, 0.249147045813402785000562436043];
      var qsqz = w * 0.5;

      // if w >= 16 then the integral lower bound (occurs for c=20)
      // is 0.99999999999995 so return a value of 1.

      if (qsqz >= bb) return 1.0;

      // find (f(w/2) - 1) ^ cc
      // (first term in integral of hartley's form).

      var pr_w = 2 * jStat.normal.cdf(qsqz, 0, 1, 1, 0) - 1; // erf(qsqz / M_SQRT2)
      // if pr_w ^ cc < 2e-22 then set pr_w = 0
      if (pr_w >= Math.exp(C2 / cc)) pr_w = Math.pow(pr_w, cc);else pr_w = 0.0;

      // if w is large then the second component of the
      // integral is small, so fewer intervals are needed.

      var wincr;
      if (w > wlar) wincr = wincr1;else wincr = wincr2;

      // find the integral of second term of hartley's form
      // for the integral of the range for equal-length
      // intervals using legendre quadrature.  limits of
      // integration are from (w/2, 8).  two or three
      // equal-length intervals are used.

      // blb and bub are lower and upper limits of integration.

      var blb = qsqz;
      var binc = (bb - qsqz) / wincr;
      var bub = blb + binc;
      var einsum = 0.0;

      // integrate over each interval

      var cc1 = cc - 1.0;
      for (var wi = 1; wi <= wincr; wi++) {
        var elsum = 0.0;
        var a = 0.5 * (bub + blb);

        // legendre quadrature with order = nleg

        var b = 0.5 * (bub - blb);
        for (var jj = 1; jj <= nleg; jj++) {
          var j, xx;
          if (ihalf < jj) {
            j = nleg - jj + 1;
            xx = xleg[j - 1];
          } else {
            j = jj;
            xx = -xleg[j - 1];
          }
          var c = b * xx;
          var ac = a + c;

          // if exp(-qexpo/2) < 9e-14,
          // then doesn't contribute to integral

          var qexpo = ac * ac;
          if (qexpo > C3) break;
          var pplus = 2 * jStat.normal.cdf(ac, 0, 1, 1, 0);
          var pminus = 2 * jStat.normal.cdf(ac, w, 1, 1, 0);

          // if rinsum ^ (cc-1) < 9e-14,
          // then doesn't contribute to integral

          var rinsum = pplus * 0.5 - pminus * 0.5;
          if (rinsum >= Math.exp(C1 / cc1)) {
            rinsum = aleg[j - 1] * Math.exp(-(0.5 * qexpo)) * Math.pow(rinsum, cc1);
            elsum += rinsum;
          }
        }
        elsum *= 2.0 * b * cc / Math.sqrt(2 * Math.PI);
        einsum += elsum;
        blb = bub;
        bub += binc;
      }

      // if pr_w ^ rr < 9e-14, then return 0
      pr_w += einsum;
      if (pr_w <= Math.exp(C1 / rr)) return 0;
      pr_w = Math.pow(pr_w, rr);
      if (pr_w >= 1)
        // 1 was iMax was eps
        return 1;
      return pr_w;
    }
    function tukeyQinv(p, c, v) {
      var p0 = 0.322232421088;
      var q0 = 0.993484626060e-01;
      var p1 = -1.0;
      var q1 = 0.588581570495;
      var p2 = -0.342242088547;
      var q2 = 0.531103462366;
      var p3 = -0.204231210125;
      var q3 = 0.103537752850;
      var p4 = -0.453642210148e-04;
      var q4 = 0.38560700634e-02;
      var c1 = 0.8832;
      var c2 = 0.2368;
      var c3 = 1.214;
      var c4 = 1.208;
      var c5 = 1.4142;
      var vmax = 120.0;
      var ps = 0.5 - 0.5 * p;
      var yi = Math.sqrt(Math.log(1.0 / (ps * ps)));
      var t = yi + ((((yi * p4 + p3) * yi + p2) * yi + p1) * yi + p0) / ((((yi * q4 + q3) * yi + q2) * yi + q1) * yi + q0);
      if (v < vmax) t += (t * t * t + t) / v / 4.0;
      var q = c1 - c2 * t;
      if (v < vmax) q += -c3 / v + c4 * t / v;
      return t * (q * Math.log(c - 1.0) + c5);
    }
    jStat.extend(jStat.tukey, {
      cdf: function cdf(q, nmeans, df) {
        // Identical implementation as the R ptukey() function as of commit 68947
        var rr = 1;
        var cc = nmeans;
        var nlegq = 16;
        var ihalfq = 8;
        var eps1 = -30.0;
        var eps2 = 1.0e-14;
        var dhaf = 100.0;
        var dquar = 800.0;
        var deigh = 5000.0;
        var dlarg = 25000.0;
        var ulen1 = 1.0;
        var ulen2 = 0.5;
        var ulen3 = 0.25;
        var ulen4 = 0.125;
        var xlegq = [0.989400934991649932596154173450, 0.944575023073232576077988415535, 0.865631202387831743880467897712, 0.755404408355003033895101194847, 0.617876244402643748446671764049, 0.458016777657227386342419442984, 0.281603550779258913230460501460, 0.950125098376374401853193354250e-1];
        var alegq = [0.271524594117540948517805724560e-1, 0.622535239386478928628438369944e-1, 0.951585116824927848099251076022e-1, 0.124628971255533872052476282192, 0.149595988816576732081501730547, 0.169156519395002538189312079030, 0.182603415044923588866763667969, 0.189450610455068496285396723208];
        if (q <= 0) return 0;

        // df must be > 1
        // there must be at least two values

        if (df < 2 || rr < 1 || cc < 2) return NaN;
        if (!Number.isFinite(q)) return 1;
        if (df > dlarg) return tukeyWprob(q, rr, cc);

        // calculate leading constant

        var f2 = df * 0.5;
        var f2lf = f2 * Math.log(df) - df * Math.log(2) - jStat.gammaln(f2);
        var f21 = f2 - 1.0;

        // integral is divided into unit, half-unit, quarter-unit, or
        // eighth-unit length intervals depending on the value of the
        // degrees of freedom.

        var ff4 = df * 0.25;
        var ulen;
        if (df <= dhaf) ulen = ulen1;else if (df <= dquar) ulen = ulen2;else if (df <= deigh) ulen = ulen3;else ulen = ulen4;
        f2lf += Math.log(ulen);

        // integrate over each subinterval

        var ans = 0.0;
        for (var i = 1; i <= 50; i++) {
          var otsum = 0.0;

          // legendre quadrature with order = nlegq
          // nodes (stored in xlegq) are symmetric around zero.

          var twa1 = (2 * i - 1) * ulen;
          for (var jj = 1; jj <= nlegq; jj++) {
            var j, t1;
            if (ihalfq < jj) {
              j = jj - ihalfq - 1;
              t1 = f2lf + f21 * Math.log(twa1 + xlegq[j] * ulen) - (xlegq[j] * ulen + twa1) * ff4;
            } else {
              j = jj - 1;
              t1 = f2lf + f21 * Math.log(twa1 - xlegq[j] * ulen) + (xlegq[j] * ulen - twa1) * ff4;
            }

            // if exp(t1) < 9e-14, then doesn't contribute to integral
            var qsqz;
            if (t1 >= eps1) {
              if (ihalfq < jj) {
                qsqz = q * Math.sqrt((xlegq[j] * ulen + twa1) * 0.5);
              } else {
                qsqz = q * Math.sqrt((-(xlegq[j] * ulen) + twa1) * 0.5);
              }

              // call wprob to find integral of range portion

              var wprb = tukeyWprob(qsqz, rr, cc);
              var rotsum = wprb * alegq[j] * Math.exp(t1);
              otsum += rotsum;
            }
            // end legendre integral for interval i
            // L200:
          }

          // if integral for interval i < 1e-14, then stop.
          // However, in order to avoid small area under left tail,
          // at least  1 / ulen  intervals are calculated.
          if (i * ulen >= 1.0 && otsum <= eps2) break;

          // end of interval i
          // L330:

          ans += otsum;
        }
        if (otsum > eps2) {
          // not converged
          throw new Error('tukey.cdf failed to converge');
        }
        if (ans > 1) ans = 1;
        return ans;
      },
      inv: function (p, nmeans, df) {
        // Identical implementation as the R qtukey() function as of commit 68947
        var rr = 1;
        var cc = nmeans;
        var eps = 0.0001;
        var maxiter = 50;

        // df must be > 1 ; there must be at least two values
        if (df < 2 || rr < 1 || cc < 2) return NaN;
        if (p < 0 || p > 1) return NaN;
        if (p === 0) return 0;
        if (p === 1) return Infinity;

        // Initial value

        var x0 = tukeyQinv(p, cc, df);

        // Find prob(value < x0)

        var valx0 = jStat.tukey.cdf(x0, nmeans, df) - p;

        // Find the second iterate and prob(value < x1).
        // If the first iterate has probability value
        // exceeding p then second iterate is 1 less than
        // first iterate; otherwise it is 1 greater.

        var x1;
        if (valx0 > 0.0) x1 = Math.max(0.0, x0 - 1.0);else x1 = x0 + 1.0;
        var valx1 = jStat.tukey.cdf(x1, nmeans, df) - p;

        // Find new iterate

        var ans;
        for (var iter = 1; iter < maxiter; iter++) {
          ans = x1 - valx1 * (x1 - x0) / (valx1 - valx0);
          valx0 = valx1;

          // New iterate must be >= 0

          x0 = x1;
          if (ans < 0.0) {
            ans = 0.0;
            valx1 = -p;
          }
          // Find prob(value < new iterate)

          valx1 = jStat.tukey.cdf(ans, nmeans, df) - p;
          x1 = ans;

          // If the difference between two successive
          // iterates is less than eps, stop

          var xabs = Math.abs(x1 - x0);
          if (xabs < eps) return ans;
        }
        throw new Error('tukey.inv failed to converge');
      }
    });
  })(jStat, Math);
  /* Provides functions for the solution of linear system of equations, integration, extrapolation,
   * interpolation, eigenvalue problems, differential equations and PCA analysis. */

  (function (jStat, Math) {
    var push = Array.prototype.push;
    var isArray = jStat.utils.isArray;
    function isUsable(arg) {
      return isArray(arg) || arg instanceof jStat;
    }
    jStat.extend({
      // add a vector/matrix to a vector/matrix or scalar
      add: function add(arr, arg) {
        // check if arg is a vector or scalar
        if (isUsable(arg)) {
          if (!isUsable(arg[0])) arg = [arg];
          return jStat.map(arr, function (value, row, col) {
            return value + arg[row][col];
          });
        }
        return jStat.map(arr, function (value) {
          return value + arg;
        });
      },
      // subtract a vector or scalar from the vector
      subtract: function subtract(arr, arg) {
        // check if arg is a vector or scalar
        if (isUsable(arg)) {
          if (!isUsable(arg[0])) arg = [arg];
          return jStat.map(arr, function (value, row, col) {
            return value - arg[row][col] || 0;
          });
        }
        return jStat.map(arr, function (value) {
          return value - arg;
        });
      },
      // matrix division
      divide: function divide(arr, arg) {
        if (isUsable(arg)) {
          if (!isUsable(arg[0])) arg = [arg];
          return jStat.multiply(arr, jStat.inv(arg));
        }
        return jStat.map(arr, function (value) {
          return value / arg;
        });
      },
      // matrix multiplication
      multiply: function multiply(arr, arg) {
        var row, col, nrescols, sum, nrow, ncol, res, rescols;
        // eg: arr = 2 arg = 3 -> 6 for res[0][0] statement closure
        if (arr.length === undefined && arg.length === undefined) {
          return arr * arg;
        }
        nrow = arr.length, ncol = arr[0].length, res = jStat.zeros(nrow, nrescols = isUsable(arg) ? arg[0].length : ncol), rescols = 0;
        if (isUsable(arg)) {
          for (; rescols < nrescols; rescols++) {
            for (row = 0; row < nrow; row++) {
              sum = 0;
              for (col = 0; col < ncol; col++) sum += arr[row][col] * arg[col][rescols];
              res[row][rescols] = sum;
            }
          }
          return nrow === 1 && rescols === 1 ? res[0][0] : res;
        }
        return jStat.map(arr, function (value) {
          return value * arg;
        });
      },
      // outer([1,2,3],[4,5,6])
      // ===
      // [[1],[2],[3]] times [[4,5,6]]
      // ->
      // [[4,5,6],[8,10,12],[12,15,18]]
      outer: function outer(A, B) {
        return jStat.multiply(A.map(function (t) {
          return [t];
        }), [B]);
      },
      // Returns the dot product of two matricies
      dot: function dot(arr, arg) {
        if (!isUsable(arr[0])) arr = [arr];
        if (!isUsable(arg[0])) arg = [arg];
        // convert column to row vector
        var left = arr[0].length === 1 && arr.length !== 1 ? jStat.transpose(arr) : arr,
          right = arg[0].length === 1 && arg.length !== 1 ? jStat.transpose(arg) : arg,
          res = [],
          row = 0,
          nrow = left.length,
          ncol = left[0].length,
          sum,
          col;
        for (; row < nrow; row++) {
          res[row] = [];
          sum = 0;
          for (col = 0; col < ncol; col++) sum += left[row][col] * right[row][col];
          res[row] = sum;
        }
        return res.length === 1 ? res[0] : res;
      },
      // raise every element by a scalar
      pow: function pow(arr, arg) {
        return jStat.map(arr, function (value) {
          return Math.pow(value, arg);
        });
      },
      // exponentiate every element
      exp: function exp(arr) {
        return jStat.map(arr, function (value) {
          return Math.exp(value);
        });
      },
      // generate the natural log of every element
      log: function exp(arr) {
        return jStat.map(arr, function (value) {
          return Math.log(value);
        });
      },
      // generate the absolute values of the vector
      abs: function abs(arr) {
        return jStat.map(arr, function (value) {
          return Math.abs(value);
        });
      },
      // computes the p-norm of the vector
      // In the case that a matrix is passed, uses the first row as the vector
      norm: function norm(arr, p) {
        var nnorm = 0,
          i = 0;
        // check the p-value of the norm, and set for most common case
        if (isNaN(p)) p = 2;
        // check if multi-dimensional array, and make vector correction
        if (isUsable(arr[0])) arr = arr[0];
        // vector norm
        for (; i < arr.length; i++) {
          nnorm += Math.pow(Math.abs(arr[i]), p);
        }
        return Math.pow(nnorm, 1 / p);
      },
      // computes the angle between two vectors in rads
      // In case a matrix is passed, this uses the first row as the vector
      angle: function angle(arr, arg) {
        return Math.acos(jStat.dot(arr, arg) / (jStat.norm(arr) * jStat.norm(arg)));
      },
      // augment one matrix by another
      // Note: this function returns a matrix, not a jStat object
      aug: function aug(a, b) {
        var newarr = [];
        var i;
        for (i = 0; i < a.length; i++) {
          newarr.push(a[i].slice());
        }
        for (i = 0; i < newarr.length; i++) {
          push.apply(newarr[i], b[i]);
        }
        return newarr;
      },
      // The inv() function calculates the inverse of a matrix
      // Create the inverse by augmenting the matrix by the identity matrix of the
      // appropriate size, and then use G-J elimination on the augmented matrix.
      inv: function inv(a) {
        var rows = a.length;
        var cols = a[0].length;
        var b = jStat.identity(rows, cols);
        var c = jStat.gauss_jordan(a, b);
        var result = [];
        var i = 0;
        var j;

        //We need to copy the inverse portion to a new matrix to rid G-J artifacts
        for (; i < rows; i++) {
          result[i] = [];
          for (j = cols; j < c[0].length; j++) result[i][j - cols] = c[i][j];
        }
        return result;
      },
      // calculate the determinant of a matrix
      det: function det(a) {
        if (a.length === 2) {
          return a[0][0] * a[1][1] - a[0][1] * a[1][0];
        }
        var determinant = 0;
        for (var i = 0; i < a.length; i++) {
          // build a sub matrix without column `i`
          var submatrix = [];
          for (var row = 1; row < a.length; row++) {
            submatrix[row - 1] = [];
            for (var col = 0; col < a.length; col++) {
              if (col < i) {
                submatrix[row - 1][col] = a[row][col];
              } else if (col > i) {
                submatrix[row - 1][col - 1] = a[row][col];
              }
            }
          }

          // alternate between + and - between determinants
          var sign = i % 2 ? -1 : 1;
          determinant += det(submatrix) * a[0][i] * sign;
        }
        return determinant;
      },
      gauss_elimination: function gauss_elimination(a, b) {
        var i = 0,
          j = 0,
          n = a.length,
          m = a[0].length,
          factor = 1,
          sum = 0,
          x = [],
          maug,
          pivot,
          temp,
          k;
        a = jStat.aug(a, b);
        maug = a[0].length;
        for (i = 0; i < n; i++) {
          pivot = a[i][i];
          j = i;
          for (k = i + 1; k < m; k++) {
            if (pivot < Math.abs(a[k][i])) {
              pivot = a[k][i];
              j = k;
            }
          }
          if (j != i) {
            for (k = 0; k < maug; k++) {
              temp = a[i][k];
              a[i][k] = a[j][k];
              a[j][k] = temp;
            }
          }
          for (j = i + 1; j < n; j++) {
            factor = a[j][i] / a[i][i];
            for (k = i; k < maug; k++) {
              a[j][k] = a[j][k] - factor * a[i][k];
            }
          }
        }
        for (i = n - 1; i >= 0; i--) {
          sum = 0;
          for (j = i + 1; j <= n - 1; j++) {
            sum = sum + x[j] * a[i][j];
          }
          x[i] = (a[i][maug - 1] - sum) / a[i][i];
        }
        return x;
      },
      gauss_jordan: function gauss_jordan(a, b) {
        var m = jStat.aug(a, b);
        var h = m.length;
        var w = m[0].length;
        var c = 0;
        var x, y, y2;
        // find max pivot
        for (y = 0; y < h; y++) {
          var maxrow = y;
          for (y2 = y + 1; y2 < h; y2++) {
            if (Math.abs(m[y2][y]) > Math.abs(m[maxrow][y])) maxrow = y2;
          }
          var tmp = m[y];
          m[y] = m[maxrow];
          m[maxrow] = tmp;
          for (y2 = y + 1; y2 < h; y2++) {
            c = m[y2][y] / m[y][y];
            for (x = y; x < w; x++) {
              m[y2][x] -= m[y][x] * c;
            }
          }
        }
        // backsubstitute
        for (y = h - 1; y >= 0; y--) {
          c = m[y][y];
          for (y2 = 0; y2 < y; y2++) {
            for (x = w - 1; x > y - 1; x--) {
              m[y2][x] -= m[y][x] * m[y2][y] / c;
            }
          }
          m[y][y] /= c;
          for (x = h; x < w; x++) {
            m[y][x] /= c;
          }
        }
        return m;
      },
      // solve equation
      // Ax=b
      // A is upper triangular matrix
      // A=[[1,2,3],[0,4,5],[0,6,7]]
      // b=[1,2,3]
      // triaUpSolve(A,b) // -> [2.666,0.1666,1.666]
      // if you use matrix style
      // A=[[1,2,3],[0,4,5],[0,6,7]]
      // b=[[1],[2],[3]]
      // will return [[2.666],[0.1666],[1.666]]
      triaUpSolve: function triaUpSolve(A, b) {
        var size = A[0].length;
        var x = jStat.zeros(1, size)[0];
        var parts;
        var matrix_mode = false;
        if (b[0].length != undefined) {
          b = b.map(function (i) {
            return i[0];
          });
          matrix_mode = true;
        }
        jStat.arange(size - 1, -1, -1).forEach(function (i) {
          parts = jStat.arange(i + 1, size).map(function (j) {
            return x[j] * A[i][j];
          });
          x[i] = (b[i] - jStat.sum(parts)) / A[i][i];
        });
        if (matrix_mode) return x.map(function (i) {
          return [i];
        });
        return x;
      },
      triaLowSolve: function triaLowSolve(A, b) {
        // like to triaUpSolve but A is lower triangular matrix
        var size = A[0].length;
        var x = jStat.zeros(1, size)[0];
        var parts;
        var matrix_mode = false;
        if (b[0].length != undefined) {
          b = b.map(function (i) {
            return i[0];
          });
          matrix_mode = true;
        }
        jStat.arange(size).forEach(function (i) {
          parts = jStat.arange(i).map(function (j) {
            return A[i][j] * x[j];
          });
          x[i] = (b[i] - jStat.sum(parts)) / A[i][i];
        });
        if (matrix_mode) return x.map(function (i) {
          return [i];
        });
        return x;
      },
      // A -> [L,U]
      // A=LU
      // L is lower triangular matrix
      // U is upper triangular matrix
      lu: function lu(A) {
        var size = A.length;
        //var L=jStat.diagonal(jStat.ones(1,size)[0]);
        var L = jStat.identity(size);
        var R = jStat.zeros(A.length, A[0].length);
        var parts;
        jStat.arange(size).forEach(function (t) {
          R[0][t] = A[0][t];
        });
        jStat.arange(1, size).forEach(function (l) {
          jStat.arange(l).forEach(function (i) {
            parts = jStat.arange(i).map(function (jj) {
              return L[l][jj] * R[jj][i];
            });
            L[l][i] = (A[l][i] - jStat.sum(parts)) / R[i][i];
          });
          jStat.arange(l, size).forEach(function (j) {
            parts = jStat.arange(l).map(function (jj) {
              return L[l][jj] * R[jj][j];
            });
            R[l][j] = A[parts.length][j] - jStat.sum(parts);
          });
        });
        return [L, R];
      },
      // A -> T
      // A=TT'
      // T is lower triangular matrix
      cholesky: function cholesky(A) {
        var size = A.length;
        var T = jStat.zeros(A.length, A[0].length);
        var parts;
        jStat.arange(size).forEach(function (i) {
          parts = jStat.arange(i).map(function (t) {
            return Math.pow(T[i][t], 2);
          });
          T[i][i] = Math.sqrt(A[i][i] - jStat.sum(parts));
          jStat.arange(i + 1, size).forEach(function (j) {
            parts = jStat.arange(i).map(function (t) {
              return T[i][t] * T[j][t];
            });
            T[j][i] = (A[i][j] - jStat.sum(parts)) / T[i][i];
          });
        });
        return T;
      },
      gauss_jacobi: function gauss_jacobi(a, b, x, r) {
        var i = 0;
        var j = 0;
        var n = a.length;
        var l = [];
        var u = [];
        var d = [];
        var xv, c, h, xk;
        for (; i < n; i++) {
          l[i] = [];
          u[i] = [];
          d[i] = [];
          for (j = 0; j < n; j++) {
            if (i > j) {
              l[i][j] = a[i][j];
              u[i][j] = d[i][j] = 0;
            } else if (i < j) {
              u[i][j] = a[i][j];
              l[i][j] = d[i][j] = 0;
            } else {
              d[i][j] = a[i][j];
              l[i][j] = u[i][j] = 0;
            }
          }
        }
        h = jStat.multiply(jStat.multiply(jStat.inv(d), jStat.add(l, u)), -1);
        c = jStat.multiply(jStat.inv(d), b);
        xv = x;
        xk = jStat.add(jStat.multiply(h, x), c);
        i = 2;
        while (Math.abs(jStat.norm(jStat.subtract(xk, xv))) > r) {
          xv = xk;
          xk = jStat.add(jStat.multiply(h, xv), c);
          i++;
        }
        return xk;
      },
      gauss_seidel: function gauss_seidel(a, b, x, r) {
        var i = 0;
        var n = a.length;
        var l = [];
        var u = [];
        var d = [];
        var j, xv, c, h, xk;
        for (; i < n; i++) {
          l[i] = [];
          u[i] = [];
          d[i] = [];
          for (j = 0; j < n; j++) {
            if (i > j) {
              l[i][j] = a[i][j];
              u[i][j] = d[i][j] = 0;
            } else if (i < j) {
              u[i][j] = a[i][j];
              l[i][j] = d[i][j] = 0;
            } else {
              d[i][j] = a[i][j];
              l[i][j] = u[i][j] = 0;
            }
          }
        }
        h = jStat.multiply(jStat.multiply(jStat.inv(jStat.add(d, l)), u), -1);
        c = jStat.multiply(jStat.inv(jStat.add(d, l)), b);
        xv = x;
        xk = jStat.add(jStat.multiply(h, x), c);
        i = 2;
        while (Math.abs(jStat.norm(jStat.subtract(xk, xv))) > r) {
          xv = xk;
          xk = jStat.add(jStat.multiply(h, xv), c);
          i = i + 1;
        }
        return xk;
      },
      SOR: function SOR(a, b, x, r, w) {
        var i = 0;
        var n = a.length;
        var l = [];
        var u = [];
        var d = [];
        var j, xv, c, h, xk;
        for (; i < n; i++) {
          l[i] = [];
          u[i] = [];
          d[i] = [];
          for (j = 0; j < n; j++) {
            if (i > j) {
              l[i][j] = a[i][j];
              u[i][j] = d[i][j] = 0;
            } else if (i < j) {
              u[i][j] = a[i][j];
              l[i][j] = d[i][j] = 0;
            } else {
              d[i][j] = a[i][j];
              l[i][j] = u[i][j] = 0;
            }
          }
        }
        h = jStat.multiply(jStat.inv(jStat.add(d, jStat.multiply(l, w))), jStat.subtract(jStat.multiply(d, 1 - w), jStat.multiply(u, w)));
        c = jStat.multiply(jStat.multiply(jStat.inv(jStat.add(d, jStat.multiply(l, w))), b), w);
        xv = x;
        xk = jStat.add(jStat.multiply(h, x), c);
        i = 2;
        while (Math.abs(jStat.norm(jStat.subtract(xk, xv))) > r) {
          xv = xk;
          xk = jStat.add(jStat.multiply(h, xv), c);
          i++;
        }
        return xk;
      },
      householder: function householder(a) {
        var m = a.length;
        var n = a[0].length;
        var i = 0;
        var w = [];
        var p = [];
        var alpha, r, k, j, factor;
        for (; i < m - 1; i++) {
          alpha = 0;
          for (j = i + 1; j < n; j++) alpha += a[j][i] * a[j][i];
          factor = a[i + 1][i] > 0 ? -1 : 1;
          alpha = factor * Math.sqrt(alpha);
          r = Math.sqrt((alpha * alpha - a[i + 1][i] * alpha) / 2);
          w = jStat.zeros(m, 1);
          w[i + 1][0] = (a[i + 1][i] - alpha) / (2 * r);
          for (k = i + 2; k < m; k++) w[k][0] = a[k][i] / (2 * r);
          p = jStat.subtract(jStat.identity(m, n), jStat.multiply(jStat.multiply(w, jStat.transpose(w)), 2));
          a = jStat.multiply(p, jStat.multiply(a, p));
        }
        return a;
      },
      // A -> [Q,R]
      // Q is orthogonal matrix
      // R is upper triangular
      QR: function () {
        // x -> Q
        // find a orthogonal matrix Q st.
        // Qx=y
        // y is [||x||,0,0,...]

        // quick ref
        var sum = jStat.sum;
        var range = jStat.arange;
        function qr2(x) {
          // quick impletation
          // https://www.stat.wisc.edu/~larget/math496/qr.html

          var n = x.length;
          var p = x[0].length;
          var r = jStat.zeros(p, p);
          x = jStat.copy(x);
          var i, j, k;
          for (j = 0; j < p; j++) {
            r[j][j] = Math.sqrt(sum(range(n).map(function (i) {
              return x[i][j] * x[i][j];
            })));
            for (i = 0; i < n; i++) {
              x[i][j] = x[i][j] / r[j][j];
            }
            for (k = j + 1; k < p; k++) {
              r[j][k] = sum(range(n).map(function (i) {
                return x[i][j] * x[i][k];
              }));
              for (i = 0; i < n; i++) {
                x[i][k] = x[i][k] - x[i][j] * r[j][k];
              }
            }
          }
          return [x, r];
        }
        return qr2;
      }(),
      lstsq: function () {
        // solve least squard problem for Ax=b as QR decomposition way if b is
        // [[b1],[b2],[b3]] form will return [[x1],[x2],[x3]] array form solution
        // else b is [b1,b2,b3] form will return [x1,x2,x3] array form solution
        function R_I(A) {
          A = jStat.copy(A);
          var size = A.length;
          var I = jStat.identity(size);
          jStat.arange(size - 1, -1, -1).forEach(function (i) {
            jStat.sliceAssign(I, {
              row: i
            }, jStat.divide(jStat.slice(I, {
              row: i
            }), A[i][i]));
            jStat.sliceAssign(A, {
              row: i
            }, jStat.divide(jStat.slice(A, {
              row: i
            }), A[i][i]));
            jStat.arange(i).forEach(function (j) {
              var c = jStat.multiply(A[j][i], -1);
              var Aj = jStat.slice(A, {
                row: j
              });
              var cAi = jStat.multiply(jStat.slice(A, {
                row: i
              }), c);
              jStat.sliceAssign(A, {
                row: j
              }, jStat.add(Aj, cAi));
              var Ij = jStat.slice(I, {
                row: j
              });
              var cIi = jStat.multiply(jStat.slice(I, {
                row: i
              }), c);
              jStat.sliceAssign(I, {
                row: j
              }, jStat.add(Ij, cIi));
            });
          });
          return I;
        }
        function qr_solve(A, b) {
          var array_mode = false;
          if (b[0].length === undefined) {
            // [c1,c2,c3] mode
            b = b.map(function (x) {
              return [x];
            });
            array_mode = true;
          }
          var QR = jStat.QR(A);
          var Q = QR[0];
          var R = QR[1];
          var attrs = A[0].length;
          var Q1 = jStat.slice(Q, {
            col: {
              end: attrs
            }
          });
          var R1 = jStat.slice(R, {
            row: {
              end: attrs
            }
          });
          var RI = R_I(R1);
          var Q2 = jStat.transpose(Q1);
          if (Q2[0].length === undefined) {
            Q2 = [Q2]; // The confusing jStat.multifly implementation threat nature process again.
          }

          var x = jStat.multiply(jStat.multiply(RI, Q2), b);
          if (x.length === undefined) {
            x = [[x]]; // The confusing jStat.multifly implementation threat nature process again.
          }

          if (array_mode) return x.map(function (i) {
            return i[0];
          });
          return x;
        }
        return qr_solve;
      }(),
      jacobi: function jacobi(a) {
        var condition = 1;
        var n = a.length;
        var e = jStat.identity(n, n);
        var ev = [];
        var b, i, j, p, q, maxim, theta, s;
        // condition === 1 only if tolerance is not reached
        while (condition === 1) {
          maxim = a[0][1];
          p = 0;
          q = 1;
          for (i = 0; i < n; i++) {
            for (j = 0; j < n; j++) {
              if (i != j) {
                if (maxim < Math.abs(a[i][j])) {
                  maxim = Math.abs(a[i][j]);
                  p = i;
                  q = j;
                }
              }
            }
          }
          if (a[p][p] === a[q][q]) theta = a[p][q] > 0 ? Math.PI / 4 : -Math.PI / 4;else theta = Math.atan(2 * a[p][q] / (a[p][p] - a[q][q])) / 2;
          s = jStat.identity(n, n);
          s[p][p] = Math.cos(theta);
          s[p][q] = -Math.sin(theta);
          s[q][p] = Math.sin(theta);
          s[q][q] = Math.cos(theta);
          // eigen vector matrix
          e = jStat.multiply(e, s);
          b = jStat.multiply(jStat.multiply(jStat.inv(s), a), s);
          a = b;
          condition = 0;
          for (i = 1; i < n; i++) {
            for (j = 1; j < n; j++) {
              if (i != j && Math.abs(a[i][j]) > 0.001) {
                condition = 1;
              }
            }
          }
        }
        for (i = 0; i < n; i++) ev.push(a[i][i]);
        //returns both the eigenvalue and eigenmatrix
        return [e, ev];
      },
      rungekutta: function rungekutta(f, h, p, t_j, u_j, order) {
        var k1, k2, u_j1, k3, k4;
        if (order === 2) {
          while (t_j <= p) {
            k1 = h * f(t_j, u_j);
            k2 = h * f(t_j + h, u_j + k1);
            u_j1 = u_j + (k1 + k2) / 2;
            u_j = u_j1;
            t_j = t_j + h;
          }
        }
        if (order === 4) {
          while (t_j <= p) {
            k1 = h * f(t_j, u_j);
            k2 = h * f(t_j + h / 2, u_j + k1 / 2);
            k3 = h * f(t_j + h / 2, u_j + k2 / 2);
            k4 = h * f(t_j + h, u_j + k3);
            u_j1 = u_j + (k1 + 2 * k2 + 2 * k3 + k4) / 6;
            u_j = u_j1;
            t_j = t_j + h;
          }
        }
        return u_j;
      },
      romberg: function romberg(f, a, b, order) {
        var i = 0;
        var h = (b - a) / 2;
        var x = [];
        var h1 = [];
        var g = [];
        var m, a1, j, k, I;
        while (i < order / 2) {
          I = f(a);
          for (j = a, k = 0; j <= b; j = j + h, k++) x[k] = j;
          m = x.length;
          for (j = 1; j < m - 1; j++) {
            I += (j % 2 !== 0 ? 4 : 2) * f(x[j]);
          }
          I = h / 3 * (I + f(b));
          g[i] = I;
          h /= 2;
          i++;
        }
        a1 = g.length;
        m = 1;
        while (a1 !== 1) {
          for (j = 0; j < a1 - 1; j++) h1[j] = (Math.pow(4, m) * g[j + 1] - g[j]) / (Math.pow(4, m) - 1);
          a1 = h1.length;
          g = h1;
          h1 = [];
          m++;
        }
        return g;
      },
      richardson: function richardson(X, f, x, h) {
        function pos(X, x) {
          var i = 0;
          var n = X.length;
          var p;
          for (; i < n; i++) if (X[i] === x) p = i;
          return p;
        }
        var h_min = Math.abs(x - X[pos(X, x) + 1]);
        var i = 0;
        var g = [];
        var h1 = [];
        var y1, y2, m, a, j;
        while (h >= h_min) {
          y1 = pos(X, x + h);
          y2 = pos(X, x);
          g[i] = (f[y1] - 2 * f[y2] + f[2 * y2 - y1]) / (h * h);
          h /= 2;
          i++;
        }
        a = g.length;
        m = 1;
        while (a != 1) {
          for (j = 0; j < a - 1; j++) h1[j] = (Math.pow(4, m) * g[j + 1] - g[j]) / (Math.pow(4, m) - 1);
          a = h1.length;
          g = h1;
          h1 = [];
          m++;
        }
        return g;
      },
      simpson: function simpson(f, a, b, n) {
        var h = (b - a) / n;
        var I = f(a);
        var x = [];
        var j = a;
        var k = 0;
        var i = 1;
        var m;
        for (; j <= b; j = j + h, k++) x[k] = j;
        m = x.length;
        for (; i < m - 1; i++) {
          I += (i % 2 !== 0 ? 4 : 2) * f(x[i]);
        }
        return h / 3 * (I + f(b));
      },
      hermite: function hermite(X, F, dF, value) {
        var n = X.length;
        var p = 0;
        var i = 0;
        var l = [];
        var dl = [];
        var A = [];
        var B = [];
        var j;
        for (; i < n; i++) {
          l[i] = 1;
          for (j = 0; j < n; j++) {
            if (i != j) l[i] *= (value - X[j]) / (X[i] - X[j]);
          }
          dl[i] = 0;
          for (j = 0; j < n; j++) {
            if (i != j) dl[i] += 1 / (X[i] - X[j]);
          }
          A[i] = (1 - 2 * (value - X[i]) * dl[i]) * (l[i] * l[i]);
          B[i] = (value - X[i]) * (l[i] * l[i]);
          p += A[i] * F[i] + B[i] * dF[i];
        }
        return p;
      },
      lagrange: function lagrange(X, F, value) {
        var p = 0;
        var i = 0;
        var j, l;
        var n = X.length;
        for (; i < n; i++) {
          l = F[i];
          for (j = 0; j < n; j++) {
            // calculating the lagrange polynomial L_i
            if (i != j) l *= (value - X[j]) / (X[i] - X[j]);
          }
          // adding the lagrange polynomials found above
          p += l;
        }
        return p;
      },
      cubic_spline: function cubic_spline(X, F, value) {
        var n = X.length;
        var i = 0,
          j;
        var A = [];
        var B = [];
        var alpha = [];
        var c = [];
        var h = [];
        var b = [];
        var d = [];
        for (; i < n - 1; i++) h[i] = X[i + 1] - X[i];
        alpha[0] = 0;
        for (i = 1; i < n - 1; i++) {
          alpha[i] = 3 / h[i] * (F[i + 1] - F[i]) - 3 / h[i - 1] * (F[i] - F[i - 1]);
        }
        for (i = 1; i < n - 1; i++) {
          A[i] = [];
          B[i] = [];
          A[i][i - 1] = h[i - 1];
          A[i][i] = 2 * (h[i - 1] + h[i]);
          A[i][i + 1] = h[i];
          B[i][0] = alpha[i];
        }
        c = jStat.multiply(jStat.inv(A), B);
        for (j = 0; j < n - 1; j++) {
          b[j] = (F[j + 1] - F[j]) / h[j] - h[j] * (c[j + 1][0] + 2 * c[j][0]) / 3;
          d[j] = (c[j + 1][0] - c[j][0]) / (3 * h[j]);
        }
        for (j = 0; j < n; j++) {
          if (X[j] > value) break;
        }
        j -= 1;
        return F[j] + (value - X[j]) * b[j] + jStat.sq(value - X[j]) * c[j] + (value - X[j]) * jStat.sq(value - X[j]) * d[j];
      },
      gauss_quadrature: function gauss_quadrature() {
        throw new Error('gauss_quadrature not yet implemented');
      },
      PCA: function PCA(X) {
        var m = X.length;
        var n = X[0].length;
        var i = 0;
        var j, temp1;
        var u = [];
        var D = [];
        var result = [];
        var temp2 = [];
        var Y = [];
        var Bt = [];
        var B = [];
        var C = [];
        var V = [];
        var Vt = [];
        for (i = 0; i < m; i++) {
          u[i] = jStat.sum(X[i]) / n;
        }
        for (i = 0; i < n; i++) {
          B[i] = [];
          for (j = 0; j < m; j++) {
            B[i][j] = X[j][i] - u[j];
          }
        }
        B = jStat.transpose(B);
        for (i = 0; i < m; i++) {
          C[i] = [];
          for (j = 0; j < m; j++) {
            C[i][j] = jStat.dot([B[i]], [B[j]]) / (n - 1);
          }
        }
        result = jStat.jacobi(C);
        V = result[0];
        D = result[1];
        Vt = jStat.transpose(V);
        for (i = 0; i < D.length; i++) {
          for (j = i; j < D.length; j++) {
            if (D[i] < D[j]) {
              temp1 = D[i];
              D[i] = D[j];
              D[j] = temp1;
              temp2 = Vt[i];
              Vt[i] = Vt[j];
              Vt[j] = temp2;
            }
          }
        }
        Bt = jStat.transpose(B);
        for (i = 0; i < m; i++) {
          Y[i] = [];
          for (j = 0; j < Bt.length; j++) {
            Y[i][j] = jStat.dot([Vt[i]], [Bt[j]]);
          }
        }
        return [X, D, Vt, Y];
      }
    });

    // extend jStat.fn with methods that require one argument
    (function (funcs) {
      for (var i = 0; i < funcs.length; i++) (function (passfunc) {
        jStat.fn[passfunc] = function (arg, func) {
          var tmpthis = this;
          // check for callback
          if (func) {
            setTimeout(function () {
              func.call(tmpthis, jStat.fn[passfunc].call(tmpthis, arg));
            }, 15);
            return this;
          }
          if (typeof jStat[passfunc](this, arg) === 'number') return jStat[passfunc](this, arg);else return jStat(jStat[passfunc](this, arg));
        };
      })(funcs[i]);
    })('add divide multiply subtract dot pow exp log abs norm angle'.split(' '));
  })(jStat, Math);
  (function (jStat, Math) {
    var slice = [].slice;
    var isNumber = jStat.utils.isNumber;
    var isArray = jStat.utils.isArray;

    // flag==true denotes use of sample standard deviation
    // Z Statistics
    jStat.extend({
      // 2 different parameter lists:
      // (value, mean, sd)
      // (value, array, flag)
      zscore: function zscore() {
        var args = slice.call(arguments);
        if (isNumber(args[1])) {
          return (args[0] - args[1]) / args[2];
        }
        return (args[0] - jStat.mean(args[1])) / jStat.stdev(args[1], args[2]);
      },
      // 3 different paramter lists:
      // (value, mean, sd, sides)
      // (zscore, sides)
      // (value, array, sides, flag)
      ztest: function ztest() {
        var args = slice.call(arguments);
        var z;
        if (isArray(args[1])) {
          // (value, array, sides, flag)
          z = jStat.zscore(args[0], args[1], args[3]);
          return args[2] === 1 ? jStat.normal.cdf(-Math.abs(z), 0, 1) : jStat.normal.cdf(-Math.abs(z), 0, 1) * 2;
        } else {
          if (args.length > 2) {
            // (value, mean, sd, sides)
            z = jStat.zscore(args[0], args[1], args[2]);
            return args[3] === 1 ? jStat.normal.cdf(-Math.abs(z), 0, 1) : jStat.normal.cdf(-Math.abs(z), 0, 1) * 2;
          } else {
            // (zscore, sides)
            z = args[0];
            return args[1] === 1 ? jStat.normal.cdf(-Math.abs(z), 0, 1) : jStat.normal.cdf(-Math.abs(z), 0, 1) * 2;
          }
        }
      }
    });
    jStat.extend(jStat.fn, {
      zscore: function zscore(value, flag) {
        return (value - this.mean()) / this.stdev(flag);
      },
      ztest: function ztest(value, sides, flag) {
        var zscore = Math.abs(this.zscore(value, flag));
        return sides === 1 ? jStat.normal.cdf(-zscore, 0, 1) : jStat.normal.cdf(-zscore, 0, 1) * 2;
      }
    });

    // T Statistics
    jStat.extend({
      // 2 parameter lists
      // (value, mean, sd, n)
      // (value, array)
      tscore: function tscore() {
        var args = slice.call(arguments);
        return args.length === 4 ? (args[0] - args[1]) / (args[2] / Math.sqrt(args[3])) : (args[0] - jStat.mean(args[1])) / (jStat.stdev(args[1], true) / Math.sqrt(args[1].length));
      },
      // 3 different paramter lists:
      // (value, mean, sd, n, sides)
      // (tscore, n, sides)
      // (value, array, sides)
      ttest: function ttest() {
        var args = slice.call(arguments);
        var tscore;
        if (args.length === 5) {
          tscore = Math.abs(jStat.tscore(args[0], args[1], args[2], args[3]));
          return args[4] === 1 ? jStat.studentt.cdf(-tscore, args[3] - 1) : jStat.studentt.cdf(-tscore, args[3] - 1) * 2;
        }
        if (isNumber(args[1])) {
          tscore = Math.abs(args[0]);
          return args[2] == 1 ? jStat.studentt.cdf(-tscore, args[1] - 1) : jStat.studentt.cdf(-tscore, args[1] - 1) * 2;
        }
        tscore = Math.abs(jStat.tscore(args[0], args[1]));
        return args[2] == 1 ? jStat.studentt.cdf(-tscore, args[1].length - 1) : jStat.studentt.cdf(-tscore, args[1].length - 1) * 2;
      }
    });
    jStat.extend(jStat.fn, {
      tscore: function tscore(value) {
        return (value - this.mean()) / (this.stdev(true) / Math.sqrt(this.cols()));
      },
      ttest: function ttest(value, sides) {
        return sides === 1 ? 1 - jStat.studentt.cdf(Math.abs(this.tscore(value)), this.cols() - 1) : jStat.studentt.cdf(-Math.abs(this.tscore(value)), this.cols() - 1) * 2;
      }
    });

    // F Statistics
    jStat.extend({
      // Paramter list is as follows:
      // (array1, array2, array3, ...)
      // or it is an array of arrays
      // array of arrays conversion
      anovafscore: function anovafscore() {
        var args = slice.call(arguments),
          expVar,
          sample,
          sampMean,
          sampSampMean,
          tmpargs,
          unexpVar,
          i,
          j;
        if (args.length === 1) {
          tmpargs = new Array(args[0].length);
          for (i = 0; i < args[0].length; i++) {
            tmpargs[i] = args[0][i];
          }
          args = tmpargs;
        }
        // Builds sample array
        sample = new Array();
        for (i = 0; i < args.length; i++) {
          sample = sample.concat(args[i]);
        }
        sampMean = jStat.mean(sample);
        // Computes the explained variance
        expVar = 0;
        for (i = 0; i < args.length; i++) {
          expVar = expVar + args[i].length * Math.pow(jStat.mean(args[i]) - sampMean, 2);
        }
        expVar /= args.length - 1;
        // Computes unexplained variance
        unexpVar = 0;
        for (i = 0; i < args.length; i++) {
          sampSampMean = jStat.mean(args[i]);
          for (j = 0; j < args[i].length; j++) {
            unexpVar += Math.pow(args[i][j] - sampSampMean, 2);
          }
        }
        unexpVar /= sample.length - args.length;
        return expVar / unexpVar;
      },
      // 2 different paramter setups
      // (array1, array2, array3, ...)
      // (anovafscore, df1, df2)
      anovaftest: function anovaftest() {
        var args = slice.call(arguments),
          df1,
          df2,
          n,
          i;
        if (isNumber(args[0])) {
          return 1 - jStat.centralF.cdf(args[0], args[1], args[2]);
        }
        var anovafscore = jStat.anovafscore(args);
        df1 = args.length - 1;
        n = 0;
        for (i = 0; i < args.length; i++) {
          n = n + args[i].length;
        }
        df2 = n - df1 - 1;
        return 1 - jStat.centralF.cdf(anovafscore, df1, df2);
      },
      ftest: function ftest(fscore, df1, df2) {
        return 1 - jStat.centralF.cdf(fscore, df1, df2);
      }
    });
    jStat.extend(jStat.fn, {
      anovafscore: function anovafscore() {
        return jStat.anovafscore(this.toArray());
      },
      anovaftes: function anovaftes() {
        var n = 0;
        var i;
        for (i = 0; i < this.length; i++) {
          n = n + this[i].length;
        }
        return jStat.ftest(this.anovafscore(), this.length - 1, n - this.length);
      }
    });

    // Tukey's range test
    jStat.extend({
      // 2 parameter lists
      // (mean1, mean2, n1, n2, sd)
      // (array1, array2, sd)
      qscore: function qscore() {
        var args = slice.call(arguments);
        var mean1, mean2, n1, n2, sd;
        if (isNumber(args[0])) {
          mean1 = args[0];
          mean2 = args[1];
          n1 = args[2];
          n2 = args[3];
          sd = args[4];
        } else {
          mean1 = jStat.mean(args[0]);
          mean2 = jStat.mean(args[1]);
          n1 = args[0].length;
          n2 = args[1].length;
          sd = args[2];
        }
        return Math.abs(mean1 - mean2) / (sd * Math.sqrt((1 / n1 + 1 / n2) / 2));
      },
      // 3 different parameter lists:
      // (qscore, n, k)
      // (mean1, mean2, n1, n2, sd, n, k)
      // (array1, array2, sd, n, k)
      qtest: function qtest() {
        var args = slice.call(arguments);
        var qscore;
        if (args.length === 3) {
          qscore = args[0];
          args = args.slice(1);
        } else if (args.length === 7) {
          qscore = jStat.qscore(args[0], args[1], args[2], args[3], args[4]);
          args = args.slice(5);
        } else {
          qscore = jStat.qscore(args[0], args[1], args[2]);
          args = args.slice(3);
        }
        var n = args[0];
        var k = args[1];
        return 1 - jStat.tukey.cdf(qscore, k, n - k);
      },
      tukeyhsd: function tukeyhsd(arrays) {
        var sd = jStat.pooledstdev(arrays);
        var means = arrays.map(function (arr) {
          return jStat.mean(arr);
        });
        var n = arrays.reduce(function (n, arr) {
          return n + arr.length;
        }, 0);
        var results = [];
        for (var i = 0; i < arrays.length; ++i) {
          for (var j = i + 1; j < arrays.length; ++j) {
            var p = jStat.qtest(means[i], means[j], arrays[i].length, arrays[j].length, sd, n, arrays.length);
            results.push([[i, j], p]);
          }
        }
        return results;
      }
    });

    // Error Bounds
    jStat.extend({
      // 2 different parameter setups
      // (value, alpha, sd, n)
      // (value, alpha, array)
      normalci: function normalci() {
        var args = slice.call(arguments),
          ans = new Array(2),
          change;
        if (args.length === 4) {
          change = Math.abs(jStat.normal.inv(args[1] / 2, 0, 1) * args[2] / Math.sqrt(args[3]));
        } else {
          change = Math.abs(jStat.normal.inv(args[1] / 2, 0, 1) * jStat.stdev(args[2]) / Math.sqrt(args[2].length));
        }
        ans[0] = args[0] - change;
        ans[1] = args[0] + change;
        return ans;
      },
      // 2 different parameter setups
      // (value, alpha, sd, n)
      // (value, alpha, array)
      tci: function tci() {
        var args = slice.call(arguments),
          ans = new Array(2),
          change;
        if (args.length === 4) {
          change = Math.abs(jStat.studentt.inv(args[1] / 2, args[3] - 1) * args[2] / Math.sqrt(args[3]));
        } else {
          change = Math.abs(jStat.studentt.inv(args[1] / 2, args[2].length - 1) * jStat.stdev(args[2], true) / Math.sqrt(args[2].length));
        }
        ans[0] = args[0] - change;
        ans[1] = args[0] + change;
        return ans;
      },
      significant: function significant(pvalue, alpha) {
        return pvalue < alpha;
      }
    });
    jStat.extend(jStat.fn, {
      normalci: function normalci(value, alpha) {
        return jStat.normalci(value, alpha, this.toArray());
      },
      tci: function tci(value, alpha) {
        return jStat.tci(value, alpha, this.toArray());
      }
    });

    // internal method for calculating the z-score for a difference of proportions test
    function differenceOfProportions(p1, n1, p2, n2) {
      if (p1 > 1 || p2 > 1 || p1 <= 0 || p2 <= 0) {
        throw new Error("Proportions should be greater than 0 and less than 1");
      }
      var pooled = (p1 * n1 + p2 * n2) / (n1 + n2);
      var se = Math.sqrt(pooled * (1 - pooled) * (1 / n1 + 1 / n2));
      return (p1 - p2) / se;
    }

    // Difference of Proportions
    jStat.extend(jStat.fn, {
      oneSidedDifferenceOfProportions: function oneSidedDifferenceOfProportions(p1, n1, p2, n2) {
        var z = differenceOfProportions(p1, n1, p2, n2);
        return jStat.ztest(z, 1);
      },
      twoSidedDifferenceOfProportions: function twoSidedDifferenceOfProportions(p1, n1, p2, n2) {
        var z = differenceOfProportions(p1, n1, p2, n2);
        return jStat.ztest(z, 2);
      }
    });
  })(jStat, Math);
  jStat.models = function () {
    function sub_regress(exog) {
      var var_count = exog[0].length;
      var modelList = jStat.arange(var_count).map(function (endog_index) {
        var exog_index = jStat.arange(var_count).filter(function (i) {
          return i !== endog_index;
        });
        return ols(jStat.col(exog, endog_index).map(function (x) {
          return x[0];
        }), jStat.col(exog, exog_index));
      });
      return modelList;
    }

    // do OLS model regress
    // exog have include const columns ,it will not generate it .In fact, exog is
    // "design matrix" look at
    //https://en.wikipedia.org/wiki/Design_matrix
    function ols(endog, exog) {
      var nobs = endog.length;
      var df_model = exog[0].length - 1;
      var df_resid = nobs - df_model - 1;
      var coef = jStat.lstsq(exog, endog);
      var predict = jStat.multiply(exog, coef.map(function (x) {
        return [x];
      })).map(function (p) {
        return p[0];
      });
      var resid = jStat.subtract(endog, predict);
      var ybar = jStat.mean(endog);
      // constant cause problem
      // var SST = jStat.sum(endog.map(function(y) {
      //   return Math.pow(y-ybar,2);
      // }));
      var SSE = jStat.sum(predict.map(function (f) {
        return Math.pow(f - ybar, 2);
      }));
      var SSR = jStat.sum(endog.map(function (y, i) {
        return Math.pow(y - predict[i], 2);
      }));
      var SST = SSE + SSR;
      var R2 = SSE / SST;
      return {
        exog: exog,
        endog: endog,
        nobs: nobs,
        df_model: df_model,
        df_resid: df_resid,
        coef: coef,
        predict: predict,
        resid: resid,
        ybar: ybar,
        SST: SST,
        SSE: SSE,
        SSR: SSR,
        R2: R2
      };
    }

    // H0: b_I=0
    // H1: b_I!=0
    function t_test(model) {
      var subModelList = sub_regress(model.exog);
      //var sigmaHat=jStat.stdev(model.resid);
      var sigmaHat = Math.sqrt(model.SSR / model.df_resid);
      var seBetaHat = subModelList.map(function (mod) {
        var SST = mod.SST;
        var R2 = mod.R2;
        return sigmaHat / Math.sqrt(SST * (1 - R2));
      });
      var tStatistic = model.coef.map(function (coef, i) {
        return (coef - 0) / seBetaHat[i];
      });
      var pValue = tStatistic.map(function (t) {
        var leftppf = jStat.studentt.cdf(t, model.df_resid);
        return (leftppf > 0.5 ? 1 - leftppf : leftppf) * 2;
      });
      var c = jStat.studentt.inv(0.975, model.df_resid);
      var interval95 = model.coef.map(function (coef, i) {
        var d = c * seBetaHat[i];
        return [coef - d, coef + d];
      });
      return {
        se: seBetaHat,
        t: tStatistic,
        p: pValue,
        sigmaHat: sigmaHat,
        interval95: interval95
      };
    }
    function F_test(model) {
      var F_statistic = model.R2 / model.df_model / ((1 - model.R2) / model.df_resid);
      var fcdf = function (x, n1, n2) {
        return jStat.beta.cdf(x / (n2 / n1 + x), n1 / 2, n2 / 2);
      };
      var pvalue = 1 - fcdf(F_statistic, model.df_model, model.df_resid);
      return {
        F_statistic: F_statistic,
        pvalue: pvalue
      };
    }
    function ols_wrap(endog, exog) {
      var model = ols(endog, exog);
      var ttest = t_test(model);
      var ftest = F_test(model);
      // Provide the Wherry / Ezekiel / McNemar / Cohen Adjusted R^2
      // Which matches the 'adjusted R^2' provided by R's lm package
      var adjust_R2 = 1 - (1 - model.R2) * ((model.nobs - 1) / model.df_resid);
      model.t = ttest;
      model.f = ftest;
      model.adjust_R2 = adjust_R2;
      return model;
    }
    return {
      ols: ols_wrap
    };
  }();
  //To regress, simply build X matrix
  //(append column of 1's) using
  //buildxmatrix and build the Y
  //matrix using buildymatrix
  //(simply the transpose)
  //and run regress.

  //Regressions

  jStat.extend({
    buildxmatrix: function buildxmatrix() {
      //Parameters will be passed in as such
      //(array1,array2,array3,...)
      //as (x1,x2,x3,...)
      //needs to be (1,x1,x2,x3,...)
      var matrixRows = new Array(arguments.length);
      for (var i = 0; i < arguments.length; i++) {
        var array = [1];
        matrixRows[i] = array.concat(arguments[i]);
      }
      return jStat(matrixRows);
    },
    builddxmatrix: function builddxmatrix() {
      //Paramters will be passed in as such
      //([array1,array2,...]
      var matrixRows = new Array(arguments[0].length);
      for (var i = 0; i < arguments[0].length; i++) {
        var array = [1];
        matrixRows[i] = array.concat(arguments[0][i]);
      }
      return jStat(matrixRows);
    },
    buildjxmatrix: function buildjxmatrix(jMat) {
      //Builds from jStat Matrix
      var pass = new Array(jMat.length);
      for (var i = 0; i < jMat.length; i++) {
        pass[i] = jMat[i];
      }
      return jStat.builddxmatrix(pass);
    },
    buildymatrix: function buildymatrix(array) {
      return jStat(array).transpose();
    },
    buildjymatrix: function buildjymatrix(jMat) {
      return jMat.transpose();
    },
    matrixmult: function matrixmult(A, B) {
      var i, j, k, result, sum;
      if (A.cols() == B.rows()) {
        if (B.rows() > 1) {
          result = [];
          for (i = 0; i < A.rows(); i++) {
            result[i] = [];
            for (j = 0; j < B.cols(); j++) {
              sum = 0;
              for (k = 0; k < A.cols(); k++) {
                sum += A.toArray()[i][k] * B.toArray()[k][j];
              }
              result[i][j] = sum;
            }
          }
          return jStat(result);
        }
        result = [];
        for (i = 0; i < A.rows(); i++) {
          result[i] = [];
          for (j = 0; j < B.cols(); j++) {
            sum = 0;
            for (k = 0; k < A.cols(); k++) {
              sum += A.toArray()[i][k] * B.toArray()[j];
            }
            result[i][j] = sum;
          }
        }
        return jStat(result);
      }
    },
    //regress and regresst to be fixed

    regress: function regress(jMatX, jMatY) {
      //print("regressin!");
      //print(jMatX.toArray());
      var innerinv = jStat.xtranspxinv(jMatX);
      //print(innerinv);
      var xtransp = jMatX.transpose();
      var next = jStat.matrixmult(jStat(innerinv), xtransp);
      return jStat.matrixmult(next, jMatY);
    },
    regresst: function regresst(jMatX, jMatY, sides) {
      var beta = jStat.regress(jMatX, jMatY);
      var compile = {};
      compile.anova = {};
      var jMatYBar = jStat.jMatYBar(jMatX, beta);
      compile.yBar = jMatYBar;
      var yAverage = jMatY.mean();
      compile.anova.residuals = jStat.residuals(jMatY, jMatYBar);
      compile.anova.ssr = jStat.ssr(jMatYBar, yAverage);
      compile.anova.msr = compile.anova.ssr / (jMatX[0].length - 1);
      compile.anova.sse = jStat.sse(jMatY, jMatYBar);
      compile.anova.mse = compile.anova.sse / (jMatY.length - (jMatX[0].length - 1) - 1);
      compile.anova.sst = jStat.sst(jMatY, yAverage);
      compile.anova.mst = compile.anova.sst / (jMatY.length - 1);
      compile.anova.r2 = 1 - compile.anova.sse / compile.anova.sst;
      if (compile.anova.r2 < 0) compile.anova.r2 = 0;
      compile.anova.fratio = compile.anova.msr / compile.anova.mse;
      compile.anova.pvalue = jStat.anovaftest(compile.anova.fratio, jMatX[0].length - 1, jMatY.length - (jMatX[0].length - 1) - 1);
      compile.anova.rmse = Math.sqrt(compile.anova.mse);
      compile.anova.r2adj = 1 - compile.anova.mse / compile.anova.mst;
      if (compile.anova.r2adj < 0) compile.anova.r2adj = 0;
      compile.stats = new Array(jMatX[0].length);
      var covar = jStat.xtranspxinv(jMatX);
      var sds, ts, ps;
      for (var i = 0; i < beta.length; i++) {
        sds = Math.sqrt(compile.anova.mse * Math.abs(covar[i][i]));
        ts = Math.abs(beta[i] / sds);
        ps = jStat.ttest(ts, jMatY.length - jMatX[0].length - 1, sides);
        compile.stats[i] = [beta[i], sds, ts, ps];
      }
      compile.regress = beta;
      return compile;
    },
    xtranspx: function xtranspx(jMatX) {
      return jStat.matrixmult(jMatX.transpose(), jMatX);
    },
    xtranspxinv: function xtranspxinv(jMatX) {
      var inner = jStat.matrixmult(jMatX.transpose(), jMatX);
      var innerinv = jStat.inv(inner);
      return innerinv;
    },
    jMatYBar: function jMatYBar(jMatX, beta) {
      var yBar = jStat.matrixmult(jMatX, beta);
      return new jStat(yBar);
    },
    residuals: function residuals(jMatY, jMatYBar) {
      return jStat.matrixsubtract(jMatY, jMatYBar);
    },
    ssr: function ssr(jMatYBar, yAverage) {
      var ssr = 0;
      for (var i = 0; i < jMatYBar.length; i++) {
        ssr += Math.pow(jMatYBar[i] - yAverage, 2);
      }
      return ssr;
    },
    sse: function sse(jMatY, jMatYBar) {
      var sse = 0;
      for (var i = 0; i < jMatY.length; i++) {
        sse += Math.pow(jMatY[i] - jMatYBar[i], 2);
      }
      return sse;
    },
    sst: function sst(jMatY, yAverage) {
      var sst = 0;
      for (var i = 0; i < jMatY.length; i++) {
        sst += Math.pow(jMatY[i] - yAverage, 2);
      }
      return sst;
    },
    matrixsubtract: function matrixsubtract(A, B) {
      var ans = new Array(A.length);
      for (var i = 0; i < A.length; i++) {
        ans[i] = new Array(A[i].length);
        for (var j = 0; j < A[i].length; j++) {
          ans[i][j] = A[i][j] - B[i][j];
        }
      }
      return jStat(ans);
    }
  });
  // Make it compatible with previous version.
  jStat.jStat = jStat;
  return jStat;
});

/***/ }),

/***/ 9721:
/***/ ((module) => {

"use strict";


var numberIsNaN = function (value) {
  return value !== value;
};
module.exports = function is(a, b) {
  if (a === 0 && b === 0) {
    return 1 / a === 1 / b;
  }
  if (a === b) {
    return true;
  }
  if (numberIsNaN(a) && numberIsNaN(b)) {
    return true;
  }
  return false;
};

/***/ }),

/***/ 8339:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var define = __webpack_require__(1779);
var callBind = __webpack_require__(1112);
var implementation = __webpack_require__(9721);
var getPolyfill = __webpack_require__(6070);
var shim = __webpack_require__(4974);
var polyfill = callBind(getPolyfill(), Object);
define(polyfill, {
  getPolyfill: getPolyfill,
  implementation: implementation,
  shim: shim
});
module.exports = polyfill;

/***/ }),

/***/ 6070:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var implementation = __webpack_require__(9721);
module.exports = function getPolyfill() {
  return typeof Object.is === 'function' ? Object.is : implementation;
};

/***/ }),

/***/ 4974:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var getPolyfill = __webpack_require__(6070);
var define = __webpack_require__(1779);
module.exports = function shimObjectIs() {
  var polyfill = getPolyfill();
  define(Object, {
    is: polyfill
  }, {
    is: function testObjectIs() {
      return Object.is !== polyfill;
    }
  });
  return polyfill;
};

/***/ }),

/***/ 8638:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var keysShim;
if (!Object.keys) {
  // modified from https://github.com/es-shims/es5-shim
  var has = Object.prototype.hasOwnProperty;
  var toStr = Object.prototype.toString;
  var isArgs = __webpack_require__(2170); // eslint-disable-line global-require
  var isEnumerable = Object.prototype.propertyIsEnumerable;
  var hasDontEnumBug = !isEnumerable.call({
    toString: null
  }, 'toString');
  var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
  var dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'];
  var equalsConstructorPrototype = function (o) {
    var ctor = o.constructor;
    return ctor && ctor.prototype === o;
  };
  var excludedKeys = {
    $applicationCache: true,
    $console: true,
    $external: true,
    $frame: true,
    $frameElement: true,
    $frames: true,
    $innerHeight: true,
    $innerWidth: true,
    $onmozfullscreenchange: true,
    $onmozfullscreenerror: true,
    $outerHeight: true,
    $outerWidth: true,
    $pageXOffset: true,
    $pageYOffset: true,
    $parent: true,
    $scrollLeft: true,
    $scrollTop: true,
    $scrollX: true,
    $scrollY: true,
    $self: true,
    $webkitIndexedDB: true,
    $webkitStorageInfo: true,
    $window: true
  };
  var hasAutomationEqualityBug = function () {
    /* global window */
    if (typeof window === 'undefined') {
      return false;
    }
    for (var k in window) {
      try {
        if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
          try {
            equalsConstructorPrototype(window[k]);
          } catch (e) {
            return true;
          }
        }
      } catch (e) {
        return true;
      }
    }
    return false;
  }();
  var equalsConstructorPrototypeIfNotBuggy = function (o) {
    /* global window */
    if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
      return equalsConstructorPrototype(o);
    }
    try {
      return equalsConstructorPrototype(o);
    } catch (e) {
      return false;
    }
  };
  keysShim = function keys(object) {
    var isObject = object !== null && typeof object === 'object';
    var isFunction = toStr.call(object) === '[object Function]';
    var isArguments = isArgs(object);
    var isString = isObject && toStr.call(object) === '[object String]';
    var theKeys = [];
    if (!isObject && !isFunction && !isArguments) {
      throw new TypeError('Object.keys called on a non-object');
    }
    var skipProto = hasProtoEnumBug && isFunction;
    if (isString && object.length > 0 && !has.call(object, 0)) {
      for (var i = 0; i < object.length; ++i) {
        theKeys.push(String(i));
      }
    }
    if (isArguments && object.length > 0) {
      for (var j = 0; j < object.length; ++j) {
        theKeys.push(String(j));
      }
    } else {
      for (var name in object) {
        if (!(skipProto && name === 'prototype') && has.call(object, name)) {
          theKeys.push(String(name));
        }
      }
    }
    if (hasDontEnumBug) {
      var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
      for (var k = 0; k < dontEnums.length; ++k) {
        if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
          theKeys.push(dontEnums[k]);
        }
      }
    }
    return theKeys;
  };
}
module.exports = keysShim;

/***/ }),

/***/ 2278:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var slice = Array.prototype.slice;
var isArgs = __webpack_require__(2170);
var origKeys = Object.keys;
var keysShim = origKeys ? function keys(o) {
  return origKeys(o);
} : __webpack_require__(8638);
var originalKeys = Object.keys;
keysShim.shim = function shimObjectKeys() {
  if (Object.keys) {
    var keysWorksWithArguments = function () {
      // Safari 5.0 bug
      var args = Object.keys(arguments);
      return args && args.length === arguments.length;
    }(1, 2);
    if (!keysWorksWithArguments) {
      Object.keys = function keys(object) {
        // eslint-disable-line func-name-matching
        if (isArgs(object)) {
          return originalKeys(slice.call(object));
        }
        return originalKeys(object);
      };
    }
  } else {
    Object.keys = keysShim;
  }
  return Object.keys || keysShim;
};
module.exports = keysShim;

/***/ }),

/***/ 2170:
/***/ ((module) => {

"use strict";


var toStr = Object.prototype.toString;
module.exports = function isArguments(value) {
  var str = toStr.call(value);
  var isArgs = str === '[object Arguments]';
  if (!isArgs) {
    isArgs = str !== '[object Array]' && value !== null && typeof value === 'object' && typeof value.length === 'number' && value.length >= 0 && toStr.call(value.callee) === '[object Function]';
  }
  return isArgs;
};

/***/ }),

/***/ 8924:
/***/ ((module) => {

// shim for using process in browser
var process = module.exports = {};

// cached from whatever global is present so that test runners that stub it
// don't break things.  But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals.  It's inside a
// function because try/catches deoptimize in certain engines.

var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
  throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout() {
  throw new Error('clearTimeout has not been defined');
}
(function () {
  try {
    if (typeof setTimeout === 'function') {
      cachedSetTimeout = setTimeout;
    } else {
      cachedSetTimeout = defaultSetTimout;
    }
  } catch (e) {
    cachedSetTimeout = defaultSetTimout;
  }
  try {
    if (typeof clearTimeout === 'function') {
      cachedClearTimeout = clearTimeout;
    } else {
      cachedClearTimeout = defaultClearTimeout;
    }
  } catch (e) {
    cachedClearTimeout = defaultClearTimeout;
  }
})();
function runTimeout(fun) {
  if (cachedSetTimeout === setTimeout) {
    //normal enviroments in sane situations
    return setTimeout(fun, 0);
  }
  // if setTimeout wasn't available but was latter defined
  if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
    cachedSetTimeout = setTimeout;
    return setTimeout(fun, 0);
  }
  try {
    // when when somebody has screwed with setTimeout but no I.E. maddness
    return cachedSetTimeout(fun, 0);
  } catch (e) {
    try {
      // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
      return cachedSetTimeout.call(null, fun, 0);
    } catch (e) {
      // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
      return cachedSetTimeout.call(this, fun, 0);
    }
  }
}
function runClearTimeout(marker) {
  if (cachedClearTimeout === clearTimeout) {
    //normal enviroments in sane situations
    return clearTimeout(marker);
  }
  // if clearTimeout wasn't available but was latter defined
  if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
    cachedClearTimeout = clearTimeout;
    return clearTimeout(marker);
  }
  try {
    // when when somebody has screwed with setTimeout but no I.E. maddness
    return cachedClearTimeout(marker);
  } catch (e) {
    try {
      // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
      return cachedClearTimeout.call(null, marker);
    } catch (e) {
      // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
      // Some versions of I.E. have different rules for clearTimeout vs setTimeout
      return cachedClearTimeout.call(this, marker);
    }
  }
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
  if (!draining || !currentQueue) {
    return;
  }
  draining = false;
  if (currentQueue.length) {
    queue = currentQueue.concat(queue);
  } else {
    queueIndex = -1;
  }
  if (queue.length) {
    drainQueue();
  }
}
function drainQueue() {
  if (draining) {
    return;
  }
  var timeout = runTimeout(cleanUpNextTick);
  draining = true;
  var len = queue.length;
  while (len) {
    currentQueue = queue;
    queue = [];
    while (++queueIndex < len) {
      if (currentQueue) {
        currentQueue[queueIndex].run();
      }
    }
    queueIndex = -1;
    len = queue.length;
  }
  currentQueue = null;
  draining = false;
  runClearTimeout(timeout);
}
process.nextTick = function (fun) {
  var args = new Array(arguments.length - 1);
  if (arguments.length > 1) {
    for (var i = 1; i < arguments.length; i++) {
      args[i - 1] = arguments[i];
    }
  }
  queue.push(new Item(fun, args));
  if (queue.length === 1 && !draining) {
    runTimeout(drainQueue);
  }
};

// v8 likes predictible objects
function Item(fun, array) {
  this.fun = fun;
  this.array = array;
}
Item.prototype.run = function () {
  this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) {
  return [];
};
process.binding = function (name) {
  throw new Error('process.binding is not supported');
};
process.cwd = function () {
  return '/';
};
process.chdir = function (dir) {
  throw new Error('process.chdir is not supported');
};
process.umask = function () {
  return 0;
};

/***/ }),

/***/ 9472:
/***/ ((module) => {

function E() {
  // Keep this empty so it's easier to inherit from
  // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
}
E.prototype = {
  on: function (name, callback, ctx) {
    var e = this.e || (this.e = {});
    (e[name] || (e[name] = [])).push({
      fn: callback,
      ctx: ctx
    });
    return this;
  },
  once: function (name, callback, ctx) {
    var self = this;
    function listener() {
      self.off(name, listener);
      callback.apply(ctx, arguments);
    }
    ;
    listener._ = callback;
    return this.on(name, listener, ctx);
  },
  emit: function (name) {
    var data = [].slice.call(arguments, 1);
    var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
    var i = 0;
    var len = evtArr.length;
    for (i; i < len; i++) {
      evtArr[i].fn.apply(evtArr[i].ctx, data);
    }
    return this;
  },
  off: function (name, callback) {
    var e = this.e || (this.e = {});
    var evts = e[name];
    var liveEvents = [];
    if (evts && callback) {
      for (var i = 0, len = evts.length; i < len; i++) {
        if (evts[i].fn !== callback && evts[i].fn._ !== callback) liveEvents.push(evts[i]);
      }
    }

    // Remove event from queue to prevent memory leak
    // Suggested by https://github.com/lazd
    // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910

    liveEvents.length ? e[name] = liveEvents : delete e[name];
    return this;
  }
};
module.exports = E;
module.exports.TinyEmitter = E;

/***/ }),

/***/ 5459:
/***/ ((module) => {

module.exports = function isBuffer(arg) {
  return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function';
};

/***/ }),

/***/ 4790:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";
// Currently in sync with Node.js lib/internal/util/types.js
// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9



var isArgumentsObject = __webpack_require__(4662);
var isGeneratorFunction = __webpack_require__(9672);
var whichTypedArray = __webpack_require__(1058);
var isTypedArray = __webpack_require__(4460);
function uncurryThis(f) {
  return f.call.bind(f);
}
var BigIntSupported = typeof BigInt !== 'undefined';
var SymbolSupported = typeof Symbol !== 'undefined';
var ObjectToString = uncurryThis(Object.prototype.toString);
var numberValue = uncurryThis(Number.prototype.valueOf);
var stringValue = uncurryThis(String.prototype.valueOf);
var booleanValue = uncurryThis(Boolean.prototype.valueOf);
if (BigIntSupported) {
  var bigIntValue = uncurryThis(BigInt.prototype.valueOf);
}
if (SymbolSupported) {
  var symbolValue = uncurryThis(Symbol.prototype.valueOf);
}
function checkBoxedPrimitive(value, prototypeValueOf) {
  if (typeof value !== 'object') {
    return false;
  }
  try {
    prototypeValueOf(value);
    return true;
  } catch (e) {
    return false;
  }
}
exports.isArgumentsObject = isArgumentsObject;
exports.isGeneratorFunction = isGeneratorFunction;
exports.isTypedArray = isTypedArray;

// Taken from here and modified for better browser support
// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js
function isPromise(input) {
  return typeof Promise !== 'undefined' && input instanceof Promise || input !== null && typeof input === 'object' && typeof input.then === 'function' && typeof input.catch === 'function';
}
exports.isPromise = isPromise;
function isArrayBufferView(value) {
  if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
    return ArrayBuffer.isView(value);
  }
  return isTypedArray(value) || isDataView(value);
}
exports.isArrayBufferView = isArrayBufferView;
function isUint8Array(value) {
  return whichTypedArray(value) === 'Uint8Array';
}
exports.isUint8Array = isUint8Array;
function isUint8ClampedArray(value) {
  return whichTypedArray(value) === 'Uint8ClampedArray';
}
exports.isUint8ClampedArray = isUint8ClampedArray;
function isUint16Array(value) {
  return whichTypedArray(value) === 'Uint16Array';
}
exports.isUint16Array = isUint16Array;
function isUint32Array(value) {
  return whichTypedArray(value) === 'Uint32Array';
}
exports.isUint32Array = isUint32Array;
function isInt8Array(value) {
  return whichTypedArray(value) === 'Int8Array';
}
exports.isInt8Array = isInt8Array;
function isInt16Array(value) {
  return whichTypedArray(value) === 'Int16Array';
}
exports.isInt16Array = isInt16Array;
function isInt32Array(value) {
  return whichTypedArray(value) === 'Int32Array';
}
exports.isInt32Array = isInt32Array;
function isFloat32Array(value) {
  return whichTypedArray(value) === 'Float32Array';
}
exports.isFloat32Array = isFloat32Array;
function isFloat64Array(value) {
  return whichTypedArray(value) === 'Float64Array';
}
exports.isFloat64Array = isFloat64Array;
function isBigInt64Array(value) {
  return whichTypedArray(value) === 'BigInt64Array';
}
exports.isBigInt64Array = isBigInt64Array;
function isBigUint64Array(value) {
  return whichTypedArray(value) === 'BigUint64Array';
}
exports.isBigUint64Array = isBigUint64Array;
function isMapToString(value) {
  return ObjectToString(value) === '[object Map]';
}
isMapToString.working = typeof Map !== 'undefined' && isMapToString(new Map());
function isMap(value) {
  if (typeof Map === 'undefined') {
    return false;
  }
  return isMapToString.working ? isMapToString(value) : value instanceof Map;
}
exports.isMap = isMap;
function isSetToString(value) {
  return ObjectToString(value) === '[object Set]';
}
isSetToString.working = typeof Set !== 'undefined' && isSetToString(new Set());
function isSet(value) {
  if (typeof Set === 'undefined') {
    return false;
  }
  return isSetToString.working ? isSetToString(value) : value instanceof Set;
}
exports.isSet = isSet;
function isWeakMapToString(value) {
  return ObjectToString(value) === '[object WeakMap]';
}
isWeakMapToString.working = typeof WeakMap !== 'undefined' && isWeakMapToString(new WeakMap());
function isWeakMap(value) {
  if (typeof WeakMap === 'undefined') {
    return false;
  }
  return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap;
}
exports.isWeakMap = isWeakMap;
function isWeakSetToString(value) {
  return ObjectToString(value) === '[object WeakSet]';
}
isWeakSetToString.working = typeof WeakSet !== 'undefined' && isWeakSetToString(new WeakSet());
function isWeakSet(value) {
  return isWeakSetToString(value);
}
exports.isWeakSet = isWeakSet;
function isArrayBufferToString(value) {
  return ObjectToString(value) === '[object ArrayBuffer]';
}
isArrayBufferToString.working = typeof ArrayBuffer !== 'undefined' && isArrayBufferToString(new ArrayBuffer());
function isArrayBuffer(value) {
  if (typeof ArrayBuffer === 'undefined') {
    return false;
  }
  return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer;
}
exports.isArrayBuffer = isArrayBuffer;
function isDataViewToString(value) {
  return ObjectToString(value) === '[object DataView]';
}
isDataViewToString.working = typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined' && isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1));
function isDataView(value) {
  if (typeof DataView === 'undefined') {
    return false;
  }
  return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView;
}
exports.isDataView = isDataView;

// Store a copy of SharedArrayBuffer in case it's deleted elsewhere
var SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;
function isSharedArrayBufferToString(value) {
  return ObjectToString(value) === '[object SharedArrayBuffer]';
}
function isSharedArrayBuffer(value) {
  if (typeof SharedArrayBufferCopy === 'undefined') {
    return false;
  }
  if (typeof isSharedArrayBufferToString.working === 'undefined') {
    isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());
  }
  return isSharedArrayBufferToString.working ? isSharedArrayBufferToString(value) : value instanceof SharedArrayBufferCopy;
}
exports.isSharedArrayBuffer = isSharedArrayBuffer;
function isAsyncFunction(value) {
  return ObjectToString(value) === '[object AsyncFunction]';
}
exports.isAsyncFunction = isAsyncFunction;
function isMapIterator(value) {
  return ObjectToString(value) === '[object Map Iterator]';
}
exports.isMapIterator = isMapIterator;
function isSetIterator(value) {
  return ObjectToString(value) === '[object Set Iterator]';
}
exports.isSetIterator = isSetIterator;
function isGeneratorObject(value) {
  return ObjectToString(value) === '[object Generator]';
}
exports.isGeneratorObject = isGeneratorObject;
function isWebAssemblyCompiledModule(value) {
  return ObjectToString(value) === '[object WebAssembly.Module]';
}
exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
function isNumberObject(value) {
  return checkBoxedPrimitive(value, numberValue);
}
exports.isNumberObject = isNumberObject;
function isStringObject(value) {
  return checkBoxedPrimitive(value, stringValue);
}
exports.isStringObject = isStringObject;
function isBooleanObject(value) {
  return checkBoxedPrimitive(value, booleanValue);
}
exports.isBooleanObject = isBooleanObject;
function isBigIntObject(value) {
  return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
}
exports.isBigIntObject = isBigIntObject;
function isSymbolObject(value) {
  return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
}
exports.isSymbolObject = isSymbolObject;
function isBoxedPrimitive(value) {
  return isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value);
}
exports.isBoxedPrimitive = isBoxedPrimitive;
function isAnyArrayBuffer(value) {
  return typeof Uint8Array !== 'undefined' && (isArrayBuffer(value) || isSharedArrayBuffer(value));
}
exports.isAnyArrayBuffer = isAnyArrayBuffer;
['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function (method) {
  Object.defineProperty(exports, method, {
    enumerable: false,
    value: function () {
      throw new Error(method + ' is not supported in userland');
    }
  });
});

/***/ }),

/***/ 4485:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

/* provided dependency */ var process = __webpack_require__(8924);
/* provided dependency */ var console = __webpack_require__(3639);
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(obj) {
  var keys = Object.keys(obj);
  var descriptors = {};
  for (var i = 0; i < keys.length; i++) {
    descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
  }
  return descriptors;
};
var formatRegExp = /%[sdj%]/g;
exports.format = function (f) {
  if (!isString(f)) {
    var objects = [];
    for (var i = 0; i < arguments.length; i++) {
      objects.push(inspect(arguments[i]));
    }
    return objects.join(' ');
  }
  var i = 1;
  var args = arguments;
  var len = args.length;
  var str = String(f).replace(formatRegExp, function (x) {
    if (x === '%%') return '%';
    if (i >= len) return x;
    switch (x) {
      case '%s':
        return String(args[i++]);
      case '%d':
        return Number(args[i++]);
      case '%j':
        try {
          return JSON.stringify(args[i++]);
        } catch (_) {
          return '[Circular]';
        }
      default:
        return x;
    }
  });
  for (var x = args[i]; i < len; x = args[++i]) {
    if (isNull(x) || !isObject(x)) {
      str += ' ' + x;
    } else {
      str += ' ' + inspect(x);
    }
  }
  return str;
};

// Mark that a method should not be used.
// Returns a modified function which warns once by default.
// If --no-deprecation is set, then it is a no-op.
exports.deprecate = function (fn, msg) {
  if (typeof process !== 'undefined' && process.noDeprecation === true) {
    return fn;
  }

  // Allow for deprecating things in the process of starting up.
  if (typeof process === 'undefined') {
    return function () {
      return exports.deprecate(fn, msg).apply(this, arguments);
    };
  }
  var warned = false;
  function deprecated() {
    if (!warned) {
      if (process.throwDeprecation) {
        throw new Error(msg);
      } else if (process.traceDeprecation) {
        console.trace(msg);
      } else {
        console.error(msg);
      }
      warned = true;
    }
    return fn.apply(this, arguments);
  }
  return deprecated;
};
var debugs = {};
var debugEnvRegex = /^$/;
if (({"NODE_ENV":"production","BASE_URL":"/"}).NODE_DEBUG) {
  var debugEnv = ({"NODE_ENV":"production","BASE_URL":"/"}).NODE_DEBUG;
  debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&').replace(/\*/g, '.*').replace(/,/g, '$|^').toUpperCase();
  debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');
}
exports.debuglog = function (set) {
  set = set.toUpperCase();
  if (!debugs[set]) {
    if (debugEnvRegex.test(set)) {
      var pid = process.pid;
      debugs[set] = function () {
        var msg = exports.format.apply(exports, arguments);
        console.error('%s %d: %s', set, pid, msg);
      };
    } else {
      debugs[set] = function () {};
    }
  }
  return debugs[set];
};

/**
 * Echos the value of a value. Trys to print the value out
 * in the best way possible given the different types.
 *
 * @param {Object} obj The object to print out.
 * @param {Object} opts Optional options object that alters the output.
 */
/* legacy: obj, showHidden, depth, colors*/
function inspect(obj, opts) {
  // default options
  var ctx = {
    seen: [],
    stylize: stylizeNoColor
  };
  // legacy...
  if (arguments.length >= 3) ctx.depth = arguments[2];
  if (arguments.length >= 4) ctx.colors = arguments[3];
  if (isBoolean(opts)) {
    // legacy...
    ctx.showHidden = opts;
  } else if (opts) {
    // got an "options" object
    exports._extend(ctx, opts);
  }
  // set default options
  if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  if (isUndefined(ctx.depth)) ctx.depth = 2;
  if (isUndefined(ctx.colors)) ctx.colors = false;
  if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  if (ctx.colors) ctx.stylize = stylizeWithColor;
  return formatValue(ctx, obj, ctx.depth);
}
exports.inspect = inspect;

// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
inspect.colors = {
  'bold': [1, 22],
  'italic': [3, 23],
  'underline': [4, 24],
  'inverse': [7, 27],
  'white': [37, 39],
  'grey': [90, 39],
  'black': [30, 39],
  'blue': [34, 39],
  'cyan': [36, 39],
  'green': [32, 39],
  'magenta': [35, 39],
  'red': [31, 39],
  'yellow': [33, 39]
};

// Don't use 'blue' not visible on cmd.exe
inspect.styles = {
  'special': 'cyan',
  'number': 'yellow',
  'boolean': 'yellow',
  'undefined': 'grey',
  'null': 'bold',
  'string': 'green',
  'date': 'magenta',
  // "name": intentionally not styling
  'regexp': 'red'
};
function stylizeWithColor(str, styleType) {
  var style = inspect.styles[styleType];
  if (style) {
    return '\u001b[' + inspect.colors[style][0] + 'm' + str + '\u001b[' + inspect.colors[style][1] + 'm';
  } else {
    return str;
  }
}
function stylizeNoColor(str, styleType) {
  return str;
}
function arrayToHash(array) {
  var hash = {};
  array.forEach(function (val, idx) {
    hash[val] = true;
  });
  return hash;
}
function formatValue(ctx, value, recurseTimes) {
  // Provide a hook for user-specified inspect functions.
  // Check that value is an object with an inspect function on it
  if (ctx.customInspect && value && isFunction(value.inspect) &&
  // Filter out the util module, it's inspect function is special
  value.inspect !== exports.inspect &&
  // Also filter out any prototype objects using the circular check.
  !(value.constructor && value.constructor.prototype === value)) {
    var ret = value.inspect(recurseTimes, ctx);
    if (!isString(ret)) {
      ret = formatValue(ctx, ret, recurseTimes);
    }
    return ret;
  }

  // Primitive types cannot have properties
  var primitive = formatPrimitive(ctx, value);
  if (primitive) {
    return primitive;
  }

  // Look up the keys of the object.
  var keys = Object.keys(value);
  var visibleKeys = arrayToHash(keys);
  if (ctx.showHidden) {
    keys = Object.getOwnPropertyNames(value);
  }

  // IE doesn't make error fields non-enumerable
  // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
  if (isError(value) && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
    return formatError(value);
  }

  // Some type of object without properties can be shortcutted.
  if (keys.length === 0) {
    if (isFunction(value)) {
      var name = value.name ? ': ' + value.name : '';
      return ctx.stylize('[Function' + name + ']', 'special');
    }
    if (isRegExp(value)) {
      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
    }
    if (isDate(value)) {
      return ctx.stylize(Date.prototype.toString.call(value), 'date');
    }
    if (isError(value)) {
      return formatError(value);
    }
  }
  var base = '',
    array = false,
    braces = ['{', '}'];

  // Make Array say that they are Array
  if (isArray(value)) {
    array = true;
    braces = ['[', ']'];
  }

  // Make functions say that they are functions
  if (isFunction(value)) {
    var n = value.name ? ': ' + value.name : '';
    base = ' [Function' + n + ']';
  }

  // Make RegExps say that they are RegExps
  if (isRegExp(value)) {
    base = ' ' + RegExp.prototype.toString.call(value);
  }

  // Make dates with properties first say the date
  if (isDate(value)) {
    base = ' ' + Date.prototype.toUTCString.call(value);
  }

  // Make error with message first say the error
  if (isError(value)) {
    base = ' ' + formatError(value);
  }
  if (keys.length === 0 && (!array || value.length == 0)) {
    return braces[0] + base + braces[1];
  }
  if (recurseTimes < 0) {
    if (isRegExp(value)) {
      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
    } else {
      return ctx.stylize('[Object]', 'special');
    }
  }
  ctx.seen.push(value);
  var output;
  if (array) {
    output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  } else {
    output = keys.map(function (key) {
      return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
    });
  }
  ctx.seen.pop();
  return reduceToSingleString(output, base, braces);
}
function formatPrimitive(ctx, value) {
  if (isUndefined(value)) return ctx.stylize('undefined', 'undefined');
  if (isString(value)) {
    var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '').replace(/'/g, "\\'").replace(/\\"/g, '"') + '\'';
    return ctx.stylize(simple, 'string');
  }
  if (isNumber(value)) return ctx.stylize('' + value, 'number');
  if (isBoolean(value)) return ctx.stylize('' + value, 'boolean');
  // For some reason typeof null is "object", so special case here.
  if (isNull(value)) return ctx.stylize('null', 'null');
}
function formatError(value) {
  return '[' + Error.prototype.toString.call(value) + ']';
}
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  var output = [];
  for (var i = 0, l = value.length; i < l; ++i) {
    if (hasOwnProperty(value, String(i))) {
      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
    } else {
      output.push('');
    }
  }
  keys.forEach(function (key) {
    if (!key.match(/^\d+$/)) {
      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
    }
  });
  return output;
}
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  var name, str, desc;
  desc = Object.getOwnPropertyDescriptor(value, key) || {
    value: value[key]
  };
  if (desc.get) {
    if (desc.set) {
      str = ctx.stylize('[Getter/Setter]', 'special');
    } else {
      str = ctx.stylize('[Getter]', 'special');
    }
  } else {
    if (desc.set) {
      str = ctx.stylize('[Setter]', 'special');
    }
  }
  if (!hasOwnProperty(visibleKeys, key)) {
    name = '[' + key + ']';
  }
  if (!str) {
    if (ctx.seen.indexOf(desc.value) < 0) {
      if (isNull(recurseTimes)) {
        str = formatValue(ctx, desc.value, null);
      } else {
        str = formatValue(ctx, desc.value, recurseTimes - 1);
      }
      if (str.indexOf('\n') > -1) {
        if (array) {
          str = str.split('\n').map(function (line) {
            return '  ' + line;
          }).join('\n').slice(2);
        } else {
          str = '\n' + str.split('\n').map(function (line) {
            return '   ' + line;
          }).join('\n');
        }
      }
    } else {
      str = ctx.stylize('[Circular]', 'special');
    }
  }
  if (isUndefined(name)) {
    if (array && key.match(/^\d+$/)) {
      return str;
    }
    name = JSON.stringify('' + key);
    if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
      name = name.slice(1, -1);
      name = ctx.stylize(name, 'name');
    } else {
      name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
      name = ctx.stylize(name, 'string');
    }
  }
  return name + ': ' + str;
}
function reduceToSingleString(output, base, braces) {
  var numLinesEst = 0;
  var length = output.reduce(function (prev, cur) {
    numLinesEst++;
    if (cur.indexOf('\n') >= 0) numLinesEst++;
    return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  }, 0);
  if (length > 60) {
    return braces[0] + (base === '' ? '' : base + '\n ') + ' ' + output.join(',\n  ') + ' ' + braces[1];
  }
  return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
}

// NOTE: These type checking functions intentionally don't use `instanceof`
// because it is fragile and can be easily faked with `Object.create()`.
exports.types = __webpack_require__(4790);
function isArray(ar) {
  return Array.isArray(ar);
}
exports.isArray = isArray;
function isBoolean(arg) {
  return typeof arg === 'boolean';
}
exports.isBoolean = isBoolean;
function isNull(arg) {
  return arg === null;
}
exports.isNull = isNull;
function isNullOrUndefined(arg) {
  return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;
function isNumber(arg) {
  return typeof arg === 'number';
}
exports.isNumber = isNumber;
function isString(arg) {
  return typeof arg === 'string';
}
exports.isString = isString;
function isSymbol(arg) {
  return typeof arg === 'symbol';
}
exports.isSymbol = isSymbol;
function isUndefined(arg) {
  return arg === void 0;
}
exports.isUndefined = isUndefined;
function isRegExp(re) {
  return isObject(re) && objectToString(re) === '[object RegExp]';
}
exports.isRegExp = isRegExp;
exports.types.isRegExp = isRegExp;
function isObject(arg) {
  return typeof arg === 'object' && arg !== null;
}
exports.isObject = isObject;
function isDate(d) {
  return isObject(d) && objectToString(d) === '[object Date]';
}
exports.isDate = isDate;
exports.types.isDate = isDate;
function isError(e) {
  return isObject(e) && (objectToString(e) === '[object Error]' || e instanceof Error);
}
exports.isError = isError;
exports.types.isNativeError = isError;
function isFunction(arg) {
  return typeof arg === 'function';
}
exports.isFunction = isFunction;
function isPrimitive(arg) {
  return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || typeof arg === 'symbol' ||
  // ES6 symbol
  typeof arg === 'undefined';
}
exports.isPrimitive = isPrimitive;
exports.isBuffer = __webpack_require__(5459);
function objectToString(o) {
  return Object.prototype.toString.call(o);
}
function pad(n) {
  return n < 10 ? '0' + n.toString(10) : n.toString(10);
}
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];

// 26 Feb 16:19:34
function timestamp() {
  var d = new Date();
  var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(':');
  return [d.getDate(), months[d.getMonth()], time].join(' ');
}

// log is just a thin wrapper to console.log that prepends a timestamp
exports.log = function () {
  console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
};

/**
 * Inherit the prototype methods from one constructor into another.
 *
 * The Function.prototype.inherits from lang.js rewritten as a standalone
 * function (not on Function.prototype). NOTE: If this file is to be loaded
 * during bootstrapping this function needs to be rewritten using some native
 * functions as prototype setup using normal JavaScript does not work as
 * expected during bootstrapping (see mirror.js in r114903).
 *
 * @param {function} ctor Constructor function which needs to inherit the
 *     prototype.
 * @param {function} superCtor Constructor function to inherit prototype from.
 */
exports.inherits = __webpack_require__(7592);
exports._extend = function (origin, add) {
  // Don't do anything if add isn't an object
  if (!add || !isObject(add)) return origin;
  var keys = Object.keys(add);
  var i = keys.length;
  while (i--) {
    origin[keys[i]] = add[keys[i]];
  }
  return origin;
};
function hasOwnProperty(obj, prop) {
  return Object.prototype.hasOwnProperty.call(obj, prop);
}
var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
exports.promisify = function promisify(original) {
  if (typeof original !== 'function') throw new TypeError('The "original" argument must be of type Function');
  if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
    var fn = original[kCustomPromisifiedSymbol];
    if (typeof fn !== 'function') {
      throw new TypeError('The "util.promisify.custom" argument must be of type Function');
    }
    Object.defineProperty(fn, kCustomPromisifiedSymbol, {
      value: fn,
      enumerable: false,
      writable: false,
      configurable: true
    });
    return fn;
  }
  function fn() {
    var promiseResolve, promiseReject;
    var promise = new Promise(function (resolve, reject) {
      promiseResolve = resolve;
      promiseReject = reject;
    });
    var args = [];
    for (var i = 0; i < arguments.length; i++) {
      args.push(arguments[i]);
    }
    args.push(function (err, value) {
      if (err) {
        promiseReject(err);
      } else {
        promiseResolve(value);
      }
    });
    try {
      original.apply(this, args);
    } catch (err) {
      promiseReject(err);
    }
    return promise;
  }
  Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
  if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
    value: fn,
    enumerable: false,
    writable: false,
    configurable: true
  });
  return Object.defineProperties(fn, getOwnPropertyDescriptors(original));
};
exports.promisify.custom = kCustomPromisifiedSymbol;
function callbackifyOnRejected(reason, cb) {
  // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
  // Because `null` is a special error value in callbacks which means "no error
  // occurred", we error-wrap so the callback consumer can distinguish between
  // "the promise rejected with null" or "the promise fulfilled with undefined".
  if (!reason) {
    var newReason = new Error('Promise was rejected with a falsy value');
    newReason.reason = reason;
    reason = newReason;
  }
  return cb(reason);
}
function callbackify(original) {
  if (typeof original !== 'function') {
    throw new TypeError('The "original" argument must be of type Function');
  }

  // We DO NOT return the promise as it gives the user a false sense that
  // the promise is actually somehow related to the callback's execution
  // and that the callback throwing will reject the promise.
  function callbackified() {
    var args = [];
    for (var i = 0; i < arguments.length; i++) {
      args.push(arguments[i]);
    }
    var maybeCb = args.pop();
    if (typeof maybeCb !== 'function') {
      throw new TypeError('The last argument must be of type Function');
    }
    var self = this;
    var cb = function () {
      return maybeCb.apply(self, arguments);
    };
    // In true node style we process the callback on `nextTick` with all the
    // implications (stack, `uncaughtException`, `async_hooks`)
    original.apply(this, args).then(function (ret) {
      process.nextTick(cb.bind(null, null, ret));
    }, function (rej) {
      process.nextTick(callbackifyOnRejected.bind(null, rej, cb));
    });
  }
  Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
  Object.defineProperties(callbackified, getOwnPropertyDescriptors(original));
  return callbackified;
}
exports.callbackify = callbackify;

/***/ }),

/***/ 1058:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var forEach = __webpack_require__(2435);
var availableTypedArrays = __webpack_require__(7086);
var callBind = __webpack_require__(1112);
var callBound = __webpack_require__(1784);
var gOPD = __webpack_require__(8280);
var $toString = callBound('Object.prototype.toString');
var hasToStringTag = __webpack_require__(4865)();
var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis;
var typedArrays = availableTypedArrays();
var $slice = callBound('String.prototype.slice');
var toStrTags = {
  __proto__: null
};
var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');
if (hasToStringTag && gOPD && getPrototypeOf) {
  forEach(typedArrays, function (typedArray) {
    if (typeof g[typedArray] === 'function') {
      var arr = new g[typedArray]();
      if (Symbol.toStringTag in arr) {
        var proto = getPrototypeOf(arr);
        var descriptor = gOPD(proto, Symbol.toStringTag);
        if (!descriptor) {
          var superProto = getPrototypeOf(proto);
          descriptor = gOPD(superProto, Symbol.toStringTag);
        }
        toStrTags[typedArray] = callBind(descriptor.get);
      }
    }
  });
}
var tryTypedArrays = function tryAllTypedArrays(value) {
  var foundName = false;
  forEach(toStrTags, function (getter, typedArray) {
    if (!foundName) {
      try {
        var name = getter(value);
        if (name === typedArray) {
          foundName = name;
        }
      } catch (e) {}
    }
  });
  return foundName;
};
var isTypedArray = __webpack_require__(4460);
module.exports = function whichTypedArray(value) {
  if (!isTypedArray(value)) {
    return false;
  }
  if (!hasToStringTag || !(Symbol.toStringTag in value)) {
    return $slice($toString(value), 8, -1);
  }
  return tryTypedArrays(value);
};

/***/ }),

/***/ 2389:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperNumberAdd = __webpack_require__(2);
var toNumber = __webpack_require__(2661);

/**
 * 加法运算
 *
 * @param { Number } num1 被加数
 * @param { Number } num2 加数
 * @return {Number}
 */
function add(num1, num2) {
  return helperNumberAdd(toNumber(num1), toNumber(num2));
}
module.exports = add;

/***/ }),

/***/ 9409:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var slice = __webpack_require__(2616);

/**
  * 创建一个函数, 调用次数超过 count 次之后执行回调并将所有结果记住后返回
  *
  * @param {Number} count 调用次数
  * @param {Function} callback 完成回调
  * @return {Object}
  */
function after(count, callback, context) {
  var runCount = 0;
  var rests = [];
  return function () {
    var args = arguments;
    runCount++;
    if (runCount <= count) {
      rests.push(args[0]);
    }
    if (runCount >= count) {
      callback.apply(context, [rests].concat(slice(args)));
    }
  };
}
module.exports = after;

/***/ }),

/***/ 1418:
/***/ ((module) => {

function arrayEach(list, iterate, context) {
  if (list) {
    if (list.forEach) {
      list.forEach(iterate, context);
    } else {
      for (var index = 0, len = list.length; index < len; index++) {
        iterate.call(context, list[index], index, list);
      }
    }
  }
}
module.exports = arrayEach;

/***/ }),

/***/ 592:
/***/ ((module) => {

function arrayIndexOf(list, val) {
  if (list.indexOf) {
    return list.indexOf(val);
  }
  for (var index = 0, len = list.length; index < len; index++) {
    if (val === list[index]) {
      return index;
    }
  }
}
module.exports = arrayIndexOf;

/***/ }),

/***/ 3920:
/***/ ((module) => {

function arrayLastIndexOf(list, val) {
  if (list.lastIndexOf) {
    return list.lastIndexOf(val);
  }
  for (var len = list.length - 1; len >= 0; len--) {
    if (val === list[len]) {
      return len;
    }
  }
  return -1;
}
module.exports = arrayLastIndexOf;

/***/ }),

/***/ 1524:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var arrayEach = __webpack_require__(1418);
var keys = __webpack_require__(1762);
var isArray = __webpack_require__(1297);
var clone = __webpack_require__(1696);
var objectAssignFns = Object.assign;
function handleAssign(destination, args, isClone) {
  var len = args.length;
  for (var source, index = 1; index < len; index++) {
    source = args[index];
    arrayEach(keys(args[index]), isClone ? function (key) {
      destination[key] = clone(source[key], isClone);
    } : function (key) {
      destination[key] = source[key];
    });
  }
  return destination;
}

/**
  * 将一个或多个源对象复制到目标对象中
  *
  * @param {Object} target 目标对象
  * @param {...Object}
  * @return {Boolean}
  */
var assign = function (target) {
  if (target) {
    var args = arguments;
    if (target === true) {
      if (args.length > 1) {
        target = isArray(target[1]) ? [] : {};
        return handleAssign(target, args, true);
      }
    } else {
      return objectAssignFns ? objectAssignFns.apply(Object, args) : handleAssign(target, args);
    }
  }
  return target;
};
module.exports = assign;

/***/ }),

/***/ 1630:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var slice = __webpack_require__(2616);

/**
  * 创建一个函数, 调用次数不超过 count 次之前执行回调并将所有结果记住后返回
  *
  * @param {Number} count 调用次数
  * @param {Function} callback 完成回调
  * @return {Object}
  */
function before(count, callback, context) {
  var runCount = 0;
  var rests = [];
  context = context || this;
  return function () {
    var args = arguments;
    runCount++;
    if (runCount < count) {
      rests.push(args[0]);
      callback.apply(context, [rests].concat(slice(args)));
    }
  };
}
module.exports = before;

/***/ }),

/***/ 6264:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var slice = __webpack_require__(2616);

/**
  * 创建一个绑定上下文的函数
  *
  * @param {Function} callback 函数
  * @param {Object} context 上下文
  * @param {*} args 额外的参数
  * @return {Object}
  */
function bind(callback, context) {
  var args = slice(arguments, 2);
  return function () {
    return callback.apply(context, slice(arguments).concat(args));
  };
}
module.exports = bind;

/***/ }),

/***/ 1682:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/* provided dependency */ var process = __webpack_require__(8924);
var staticStrUndefined = __webpack_require__(4194);
var staticDocument = __webpack_require__(6515);
var staticWindow = __webpack_require__(7743);
var assign = __webpack_require__(1524);
var arrayEach = __webpack_require__(1418);

/* eslint-disable valid-typeof */
function isBrowseStorage(storage) {
  try {
    var testKey = '__xe_t';
    storage.setItem(testKey, 1);
    storage.removeItem(testKey);
    return true;
  } catch (e) {
    return false;
  }
}
function isBrowseType(type) {
  return navigator.userAgent.indexOf(type) > -1;
}

/**
  * 获取浏览器内核
  * @return Object
  */
function browse() {
  var $body, isChrome, isEdge;
  var isMobile = false;
  var isLocalStorage = false;
  var isSessionStorage = false;
  var result = {
    isNode: false,
    isMobile: isMobile,
    isPC: false,
    isDoc: !!staticDocument
  };
  if (!staticWindow && typeof process !== staticStrUndefined) {
    result.isNode = true;
  } else {
    isEdge = isBrowseType('Edge');
    isChrome = isBrowseType('Chrome');
    isMobile = /(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent);
    if (result.isDoc) {
      $body = staticDocument.body || staticDocument.documentElement;
      arrayEach(['webkit', 'khtml', 'moz', 'ms', 'o'], function (core) {
        result['-' + core] = !!$body[core + 'MatchesSelector'];
      });
    }
    try {
      isLocalStorage = isBrowseStorage(staticWindow.localStorage);
    } catch (e) {}
    try {
      isSessionStorage = isBrowseStorage(staticWindow.sessionStorage);
    } catch (e) {}
    assign(result, {
      edge: isEdge,
      firefox: isBrowseType('Firefox'),
      msie: !isEdge && result['-ms'],
      safari: !isChrome && !isEdge && isBrowseType('Safari'),
      isMobile: isMobile,
      isPC: !isMobile,
      isLocalStorage: isLocalStorage,
      isSessionStorage: isSessionStorage
    });
  }
  return result;
}
module.exports = browse;

/***/ }),

/***/ 2202:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var toValueString = __webpack_require__(6220);
var helperStringSubstring = __webpack_require__(8461);
var helperStringUpperCase = __webpack_require__(9523);
var helperStringLowerCase = __webpack_require__(4039);
var camelCacheMaps = {};

/**
  * 将带字符串转成驼峰字符串,例如： project-name 转为 projectName
  *
  * @param {String} str 字符串
  * @return {String}
  */
function camelCase(str) {
  str = toValueString(str);
  if (camelCacheMaps[str]) {
    return camelCacheMaps[str];
  }
  var strLen = str.length;
  var rest = str.replace(/([-]+)/g, function (text, flag, index) {
    return index && index + flag.length < strLen ? '-' : '';
  });
  strLen = rest.length;
  rest = rest.replace(/([A-Z]+)/g, function (text, upper, index) {
    var upperLen = upper.length;
    upper = helperStringLowerCase(upper);
    if (index) {
      if (upperLen > 2 && index + upperLen < strLen) {
        return helperStringUpperCase(helperStringSubstring(upper, 0, 1)) + helperStringSubstring(upper, 1, upperLen - 1) + helperStringUpperCase(helperStringSubstring(upper, upperLen - 1, upperLen));
      }
      return helperStringUpperCase(helperStringSubstring(upper, 0, 1)) + helperStringSubstring(upper, 1, upperLen);
    } else {
      if (upperLen > 1 && index + upperLen < strLen) {
        return helperStringSubstring(upper, 0, upperLen - 1) + helperStringUpperCase(helperStringSubstring(upper, upperLen - 1, upperLen));
      }
    }
    return upper;
  }).replace(/(-[a-zA-Z])/g, function (text, upper) {
    return helperStringUpperCase(helperStringSubstring(upper, 1, upper.length));
  });
  camelCacheMaps[str] = rest;
  return rest;
}
module.exports = camelCase;

/***/ }),

/***/ 2293:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateMathNumber = __webpack_require__(2148);

/**
 * 将数值向上舍入
 *
 * @param {string|number} num 数值
 * @param {number} digits 小数保留位数
 * @return {number}
 */
var ceil = helperCreateMathNumber('ceil');
module.exports = ceil;

/***/ }),

/***/ 310:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isArray = __webpack_require__(1297);

/**
  * 将一个数组分割成大小的组。如果数组不能被平均分配，那么最后一块将是剩下的元素
  *
  * @param {Array} array 数组
  * @param {Number} size 每组大小
  * @return {Array}
  */
function chunk(array, size) {
  var index;
  var result = [];
  var arrLen = size >> 0 || 1;
  if (isArray(array)) {
    if (arrLen >= 0 && array.length > arrLen) {
      index = 0;
      while (index < array.length) {
        result.push(array.slice(index, index + arrLen));
        index += arrLen;
      }
    } else {
      result = array.length ? [array] : array;
    }
  }
  return result;
}
module.exports = chunk;

/***/ }),

/***/ 2095:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperDeleteProperty = __webpack_require__(7203);
var isPlainObject = __webpack_require__(7143);
var isObject = __webpack_require__(8840);
var isArray = __webpack_require__(1297);
var isNull = __webpack_require__(7001);
var assign = __webpack_require__(1524);
var objectEach = __webpack_require__(8480);

/**
  * 清空对象
  *
  * @param {Object} obj 对象
  * @param {*} defs 默认值,如果不传（清空所有属性）、如果传对象（清空并继承)、如果传值(给所有赋值)
  * @param {Object/Array} assigns 默认值
  * @return {Object}
  */
function clear(obj, defs, assigns) {
  if (obj) {
    var len;
    var isDefs = arguments.length > 1 && (isNull(defs) || !isObject(defs));
    var extds = isDefs ? assigns : defs;
    if (isPlainObject(obj)) {
      objectEach(obj, isDefs ? function (val, key) {
        obj[key] = defs;
      } : function (val, key) {
        helperDeleteProperty(obj, key);
      });
      if (extds) {
        assign(obj, extds);
      }
    } else if (isArray(obj)) {
      if (isDefs) {
        len = obj.length;
        while (len > 0) {
          len--;
          obj[len] = defs;
        }
      } else {
        obj.length = 0;
      }
      if (extds) {
        obj.push.apply(obj, extds);
      }
    }
  }
  return obj;
}
module.exports = clear;

/***/ }),

/***/ 1696:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var objectToString = __webpack_require__(1081);
var objectEach = __webpack_require__(8480);
var arrayEach = __webpack_require__(1418);
function getCativeCtor(val, args) {
  var Ctor = val.__proto__.constructor;
  return args ? new Ctor(args) : new Ctor();
}
function handleValueClone(item, isDeep) {
  return isDeep ? copyValue(item, isDeep) : item;
}
function copyValue(val, isDeep) {
  if (val) {
    switch (objectToString.call(val)) {
      case "[object Object]":
        {
          var restObj = Object.create(Object.getPrototypeOf(val));
          objectEach(val, function (item, key) {
            restObj[key] = handleValueClone(item, isDeep);
          });
          return restObj;
        }
      case "[object Date]":
      case "[object RegExp]":
        {
          return getCativeCtor(val, val.valueOf());
        }
      case "[object Array]":
      case "[object Arguments]":
        {
          var restArr = [];
          arrayEach(val, function (item) {
            restArr.push(handleValueClone(item, isDeep));
          });
          return restArr;
        }
      case "[object Set]":
        {
          var restSet = getCativeCtor(val);
          restSet.forEach(function (item) {
            restSet.add(handleValueClone(item, isDeep));
          });
          return restSet;
        }
      case "[object Map]":
        {
          var restMap = getCativeCtor(val);
          restMap.forEach(function (item, key) {
            restMap.set(key, handleValueClone(item, isDeep));
          });
          return restMap;
        }
    }
  }
  return val;
}

/**
  * 浅拷贝/深拷贝
  *
  * @param {Object} obj 对象/数组
  * @param {Boolean} deep 是否深拷贝
  * @return {Object}
  */
function clone(obj, deep) {
  if (obj) {
    return copyValue(obj, deep);
  }
  return obj;
}
module.exports = clone;

/***/ }),

/***/ 9987:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var setupDefaults = __webpack_require__(1450);
var round = __webpack_require__(3221);
var ceil = __webpack_require__(2293);
var floor = __webpack_require__(8792);
var isNumber = __webpack_require__(504);
var toValueString = __webpack_require__(6220);
var toFixed = __webpack_require__(6854);
var toNumberString = __webpack_require__(9730);
var assign = __webpack_require__(1524);

/**
  * 千分位分隔符、小数点
  *
  * @param {String/Number} num 数值
  * @param {CommafyOptions} options 参数
  * @return {String}
 */
function commafy(num, options) {
  var opts = assign({}, setupDefaults.commafyOptions, options);
  var optDigits = opts.digits;
  var isNum = isNumber(num);
  var rest, result, isNegative, intStr, floatStr;
  if (isNum) {
    rest = (opts.ceil ? ceil : opts.floor ? floor : round)(num, optDigits);
    result = toNumberString(optDigits ? toFixed(rest, optDigits) : rest).split('.');
    intStr = result[0];
    floatStr = result[1];
    isNegative = intStr && rest < 0;
    if (isNegative) {
      intStr = intStr.substring(1, intStr.length);
    }
  } else {
    rest = toValueString(num).replace(/,/g, '');
    result = rest ? [rest] : [];
    intStr = result[0];
  }
  if (result.length) {
    return (isNegative ? '-' : '') + intStr.replace(new RegExp('(?=(?!(\\b))(.{' + (opts.spaceNumber || 3) + '})+$)', 'g'), opts.separator || ',') + (floatStr ? '.' + floatStr : '');
  }
  return rest;
}
module.exports = commafy;

/***/ }),

/***/ 2289:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var setupDefaults = __webpack_require__(1450);
var staticDocument = __webpack_require__(6515);
var staticDecodeURIComponent = __webpack_require__(5709);
var staticEncodeURIComponent = __webpack_require__(8372);
var isArray = __webpack_require__(1297);
var isObject = __webpack_require__(8840);
var isDate = __webpack_require__(6602);
var isUndefined = __webpack_require__(9139);
var includes = __webpack_require__(9916);
var keys = __webpack_require__(1762);
var assign = __webpack_require__(1524);
var arrayEach = __webpack_require__(1418);
var helperNewDate = __webpack_require__(2763);
var helperGetDateTime = __webpack_require__(4404);
var getWhatYear = __webpack_require__(5985);
var getWhatMonth = __webpack_require__(8483);
var getWhatDay = __webpack_require__(1522);
function toCookieUnitTime(unit, expires) {
  var num = parseFloat(expires);
  var nowdate = helperNewDate();
  var time = helperGetDateTime(nowdate);
  switch (unit) {
    case 'y':
      return helperGetDateTime(getWhatYear(nowdate, num));
    case 'M':
      return helperGetDateTime(getWhatMonth(nowdate, num));
    case 'd':
      return helperGetDateTime(getWhatDay(nowdate, num));
    case 'h':
    case 'H':
      return time + num * 60 * 60 * 1000;
    case 'm':
      return time + num * 60 * 1000;
    case 's':
      return time + num * 1000;
  }
  return time;
}
function toCookieUTCString(date) {
  return (isDate(date) ? date : new Date(date)).toUTCString();
}

/**
  * cookie操作函数
  * @param {String/Array/Object} name 键/数组/对象
  * @param {String} value 值
  * @param {Object} options 参数
  *   @param {String} name: 键
  *   @param {Object} value: 值
  *   @param {String} path: 路径
  *   @param {String} domain: 作用域
  *   @param {Boolean} secure: 设置为安全的,只能用https协议
  *   @param {Number} expires: 过期时间,可以指定日期或者字符串，默认天
  */
function cookie(name, value, options) {
  if (staticDocument) {
    var opts, expires, values, result, cookies, keyIndex;
    var inserts = [];
    var args = arguments;
    if (isArray(name)) {
      inserts = name;
    } else if (args.length > 1) {
      inserts = [assign({
        name: name,
        value: value
      }, options)];
    } else if (isObject(name)) {
      inserts = [name];
    }
    if (inserts.length > 0) {
      arrayEach(inserts, function (obj) {
        opts = assign({}, setupDefaults.cookies, obj);
        values = [];
        if (opts.name) {
          expires = opts.expires;
          values.push(staticEncodeURIComponent(opts.name) + '=' + staticEncodeURIComponent(isObject(opts.value) ? JSON.stringify(opts.value) : opts.value));
          if (expires) {
            if (isNaN(expires)) {
              // UTCString || Unit
              expires = expires.replace(/^([0-9]+)(y|M|d|H|h|m|s)$/, function (text, num, unit) {
                return toCookieUTCString(toCookieUnitTime(unit, num));
              });
            } else if (/^[0-9]{11,13}$/.test(expires) || isDate(expires)) {
              // Date || now
              expires = toCookieUTCString(expires);
            } else {
              // day
              expires = toCookieUTCString(toCookieUnitTime('d', expires));
            }
            opts.expires = expires;
          }
          arrayEach(['expires', 'path', 'domain', 'secure'], function (key) {
            if (!isUndefined(opts[key])) {
              values.push(opts[key] && key === 'secure' ? key : key + '=' + opts[key]);
            }
          });
        }
        staticDocument.cookie = values.join('; ');
      });
      return true;
    } else {
      result = {};
      cookies = staticDocument.cookie;
      if (cookies) {
        arrayEach(cookies.split('; '), function (val) {
          keyIndex = val.indexOf('=');
          result[staticDecodeURIComponent(val.substring(0, keyIndex))] = staticDecodeURIComponent(val.substring(keyIndex + 1) || '');
        });
      }
      return args.length === 1 ? result[name] : result;
    }
  }
  return false;
}
function hasCookieItem(value) {
  return includes(cookieKeys(), value);
}
function getCookieItem(name) {
  return cookie(name);
}
function setCookieItem(name, value, options) {
  cookie(name, value, options);
  return cookie;
}
function removeCookieItem(name, options) {
  cookie(name, '', assign({
    expires: -1
  }, setupDefaults.cookies, options));
}
function cookieKeys() {
  return keys(cookie());
}
function cookieJson() {
  return cookie();
}
assign(cookie, {
  has: hasCookieItem,
  set: setCookieItem,
  setItem: setCookieItem,
  get: getCookieItem,
  getItem: getCookieItem,
  remove: removeCookieItem,
  removeItem: removeCookieItem,
  keys: cookieKeys,
  getJSON: cookieJson
});
module.exports = cookie;

/***/ }),

/***/ 8529:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isArray = __webpack_require__(1297);

/**
  * 浅复制数组的一部分到同一数组中的另一个位置,数组大小不变
  *
  * @param {Array} array 数组
  * @param {Number} target 从该位置开始替换数据
  * @param {Number} start 从该位置开始读取数据，默认为 0 。如果为负值，表示倒数
  * @param {Number} end 到该位置前停止读取数据，默认等于数组长度。如果为负值，表示倒数
  * @return {Array}
  */
function copyWithin(array, target, start, end) {
  if (isArray(array) && array.copyWithin) {
    return array.copyWithin(target, start, end);
  }
  var replaceIndex, replaceArray;
  var targetIndex = target >> 0;
  var startIndex = start >> 0;
  var len = array.length;
  var endIndex = arguments.length > 3 ? end >> 0 : len;
  if (targetIndex < len) {
    targetIndex = targetIndex >= 0 ? targetIndex : len + targetIndex;
    if (targetIndex >= 0) {
      startIndex = startIndex >= 0 ? startIndex : len + startIndex;
      endIndex = endIndex >= 0 ? endIndex : len + endIndex;
      if (startIndex < endIndex) {
        for (replaceIndex = 0, replaceArray = array.slice(startIndex, endIndex); targetIndex < len; targetIndex++) {
          if (replaceArray.length <= replaceIndex) {
            break;
          }
          array[targetIndex] = replaceArray[replaceIndex++];
        }
      }
    }
  }
  return array;
}
module.exports = copyWithin;

/***/ }),

/***/ 2665:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var groupBy = __webpack_require__(1559);
var objectEach = __webpack_require__(8480);

/**
  * 集合分组统计,返回各组中对象的数量统计
  *
  * @param {Array} obj 对象
  * @param {Function} iterate 回调/对象属性
  * @param {Object} context 上下文
  * @return {Object}
  */
function countBy(obj, iterate, context) {
  var result = groupBy(obj, iterate, context || this);
  objectEach(result, function (item, key) {
    result[key] = item.length;
  });
  return result;
}
module.exports = countBy;

/***/ }),

/***/ 2810:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var setupDefaults = __webpack_require__(1450);
var arrayEach = __webpack_require__(1418);
var each = __webpack_require__(5360);
var isFunction = __webpack_require__(7379);
var assign = __webpack_require__(1524);
var XEUtils = function () {};
function mixin() {
  arrayEach(arguments, function (methods) {
    each(methods, function (fn, name) {
      XEUtils[name] = isFunction(fn) ? function () {
        var result = fn.apply(XEUtils.$context, arguments);
        XEUtils.$context = null;
        return result;
      } : fn;
    });
  });
}
function setup(options) {
  return assign(setupDefaults, options);
}
XEUtils.VERSION = '3.6.0';
XEUtils.mixin = mixin;
XEUtils.setup = setup;
module.exports = XEUtils;

/***/ }),

/***/ 1429:
/***/ ((module) => {

/**
  * 函数去抖；当被调用 n 毫秒后才会执行，如果在这时间内又被调用则将重新计算执行时间
  *
  * @param {Function} callback 回调
  * @param {Number} wait 多少秒毫
  * @param {Object} options 参数{leading: 是否在之前执行, trailing: 是否在之后执行}
  * @return {Function}
  */
function debounce(callback, wait, options) {
  var args = null;
  var context = null;
  var opts = options || {};
  var runFlag = false;
  var timeout = null;
  var isLeading = typeof options === 'boolean';
  var optLeading = 'leading' in opts ? opts.leading : isLeading;
  var optTrailing = 'trailing' in opts ? opts.trailing : !isLeading;
  var gcFn = function () {
    args = null;
    context = null;
  };
  var runFn = function () {
    runFlag = true;
    callback.apply(context, args);
    gcFn();
  };
  var endFn = function () {
    if (optLeading === true) {
      timeout = null;
    }
    if (!runFlag && optTrailing === true) {
      runFn();
    }
  };
  var cancelFn = function () {
    var rest = timeout !== null;
    if (rest) {
      clearTimeout(timeout);
    }
    gcFn();
    timeout = null;
    runFlag = false;
    return rest;
  };
  var debounced = function () {
    runFlag = false;
    args = arguments;
    context = this;
    if (timeout === null) {
      if (optLeading === true) {
        runFn();
      }
    } else {
      clearTimeout(timeout);
    }
    timeout = setTimeout(endFn, wait);
  };
  debounced.cancel = cancelFn;
  return debounced;
}
module.exports = debounce;

/***/ }),

/***/ 5011:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var slice = __webpack_require__(2616);

/**
  * 该方法和 setTimeout 一样的效果，区别就是支持上下文和额外参数
  *
  * @param {Function} callback 函数
  * @param {Number} wait 延迟毫秒
  * @param {*} args 额外的参数
  * @return {Number}
 */
function delay(callback, wait) {
  var args = slice(arguments, 2);
  var context = this;
  return setTimeout(function () {
    callback.apply(context, args);
  }, wait);
}
module.exports = delay;

/***/ }),

/***/ 3693:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var keys = __webpack_require__(1762);
var slice = __webpack_require__(2616);
var includes = __webpack_require__(9916);
var arrayEach = __webpack_require__(1418);
var assign = __webpack_require__(1524);

/**
  * 将一个或者多个对象值解构到目标对象
  *
  * @param {Object} destination 目标对象
  * @param {...Object}
  * @return {Boolean}
  */
function destructuring(destination, sources) {
  if (destination && sources) {
    var rest = assign.apply(this, [{}].concat(slice(arguments, 1)));
    var restKeys = keys(rest);
    arrayEach(keys(destination), function (key) {
      if (includes(restKeys, key)) {
        destination[key] = rest[key];
      }
    });
  }
  return destination;
}
module.exports = destructuring;

/***/ }),

/***/ 8685:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperNumberDivide = __webpack_require__(436);
var toNumber = __webpack_require__(2661);

/**
 * 除法运算
 *
 * @param { Number } num1 数值1
 * @param { Number } num2 数值2
 * @return {Number}
 */
function divide(num1, num2) {
  return helperNumberDivide(toNumber(num1), toNumber(num2));
}
module.exports = divide;

/***/ }),

/***/ 5360:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isArray = __webpack_require__(1297);
var arrayEach = __webpack_require__(1418);
var objectEach = __webpack_require__(8480);

/**
  * 迭代器
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
function each(obj, iterate, context) {
  if (obj) {
    return (isArray(obj) ? arrayEach : objectEach)(obj, iterate, context);
  }
  return obj;
}
module.exports = each;

/***/ }),

/***/ 2312:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateTreeFunc = __webpack_require__(5366);
var each = __webpack_require__(5360);
function eachTreeItem(parent, obj, iterate, context, path, node, parseChildren, opts) {
  var paths, nodes;
  each(obj, function (item, index) {
    paths = path.concat(['' + index]);
    nodes = node.concat([item]);
    iterate.call(context, item, index, obj, paths, parent, nodes);
    if (item && parseChildren) {
      paths.push(parseChildren);
      eachTreeItem(item, item[parseChildren], iterate, context, paths, nodes, parseChildren, opts);
    }
  });
}

/**
  * 从树结构中遍历数据的键、值、路径
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, items, path, parent, nodes) 回调
  * @param {Object} options {children: 'children', mapChildren: 'children}
  * @param {Object} context 上下文
  */
var eachTree = helperCreateTreeFunc(eachTreeItem);
module.exports = eachTree;

/***/ }),

/***/ 7646:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var toValueString = __webpack_require__(6220);

/**
  * 判断字符串是否在源字符串的尾部
  *
  * @param {String} str 字符串
  * @param {String/Number} val 值
  * @param {Number} startIndex 开始索引
  * @return {String}
  */
function endsWith(str, val, startIndex) {
  var rest = toValueString(str);
  var argsLen = arguments.length;
  return argsLen > 1 && (argsLen > 2 ? rest.substring(0, startIndex).indexOf(val) === startIndex - 1 : rest.indexOf(val) === rest.length - 1);
}
module.exports = endsWith;

/***/ }),

/***/ 6989:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateGetObjects = __webpack_require__(1137);

/**
  * 获取对象所有属性、值
  *
  * @param {Object} obj 对象/数组
  * @return {Array}
  */
var entries = helperCreateGetObjects('entries', 2);
module.exports = entries;

/***/ }),

/***/ 8878:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isNull = __webpack_require__(7001);
var isUndefined = __webpack_require__(9139);

/**
 * 判断是否 undefined 和 null
 * @param {Object} obj 对象
 * @return {Boolean}
 */
function eqNull(obj) {
  return isNull(obj) || isUndefined(obj);
}
module.exports = eqNull;

/***/ }),

/***/ 2112:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticEscapeMap = __webpack_require__(6083);
var helperFormatEscaper = __webpack_require__(3277);

/**
  * 转义HTML字符串，替换&, <, >, ", ', `字符
  *
  * @param {String} str 字符串
  * @return {String}
  */
var escape = helperFormatEscaper(staticEscapeMap);
module.exports = escape;

/***/ }),

/***/ 753:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateIterateHandle = __webpack_require__(7889);

/**
  * 对象中的值中的每一项运行给定函数,如果该函数对每一项都返回true,则返回true,否则返回false
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Boolean}
  */
var every = helperCreateIterateHandle('every', 1, 1, false, true);
module.exports = every;

/***/ }),

/***/ 6881:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var each = __webpack_require__(5360);

/**
  * 根据回调过滤数据
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
function filter(obj, iterate, context) {
  var result = [];
  if (obj && iterate) {
    if (obj.filter) {
      return obj.filter(iterate, context);
    }
    each(obj, function (val, key) {
      if (iterate.call(context, val, key, obj)) {
        result.push(val);
      }
    });
  }
  return result;
}
module.exports = filter;

/***/ }),

/***/ 5451:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var eachTree = __webpack_require__(2312);

/**
  * 从树结构中根据回调过滤数据
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, items, path, parent) 回调
  * @param {Object} options {children: 'children'}
  * @param {Object} context 上下文
  * @return {Array}
  */
function filterTree(obj, iterate, options, context) {
  var result = [];
  if (obj && iterate) {
    eachTree(obj, function (item, index, items, path, parent, nodes) {
      if (iterate.call(context, item, index, items, path, parent, nodes)) {
        result.push(item);
      }
    }, options);
  }
  return result;
}
module.exports = filterTree;

/***/ }),

/***/ 5491:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateIterateHandle = __webpack_require__(7889);

/**
  * 从左至右遍历，匹配最近的一条数据
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
var find = helperCreateIterateHandle('find', 1, 3, true);
module.exports = find;

/***/ }),

/***/ 6655:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateiterateIndexOf = __webpack_require__(3091);

/**
  * 返回对象第一个索引值
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
var findIndexOf = helperCreateiterateIndexOf(function (obj, iterate, context) {
  for (var index = 0, len = obj.length; index < len; index++) {
    if (iterate.call(context, obj[index], index, obj)) {
      return index;
    }
  }
  return -1;
});
module.exports = findIndexOf;

/***/ }),

/***/ 747:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateIterateHandle = __webpack_require__(7889);

/**
  * 查找匹配第一条数据的键
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
var findKey = helperCreateIterateHandle('', 0, 2, true);
module.exports = findKey;

/***/ }),

/***/ 4281:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isArray = __webpack_require__(1297);
var values = __webpack_require__(3656);

/**
  * 从右至左遍历，匹配最近的一条数据
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
function findLast(obj, iterate, context) {
  if (obj) {
    if (!isArray(obj)) {
      obj = values(obj);
    }
    for (var len = obj.length - 1; len >= 0; len--) {
      if (iterate.call(context, obj[len], len, obj)) {
        return obj[len];
      }
    }
  }
}
module.exports = findLast;

/***/ }),

/***/ 1398:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateiterateIndexOf = __webpack_require__(3091);

/**
  * 从最后开始的索引值,返回对象第一个索引值
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
var findLastIndexOf = helperCreateiterateIndexOf(function (obj, iterate, context) {
  for (var len = obj.length - 1; len >= 0; len--) {
    if (iterate.call(context, obj[len], len, obj)) {
      return len;
    }
  }
  return -1;
});
module.exports = findLastIndexOf;

/***/ }),

/***/ 6463:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateTreeFunc = __webpack_require__(5366);
function findTreeItem(parent, obj, iterate, context, path, node, parseChildren, opts) {
  if (obj) {
    var item, index, len, paths, nodes, match;
    for (index = 0, len = obj.length; index < len; index++) {
      item = obj[index];
      paths = path.concat(['' + index]);
      nodes = node.concat([item]);
      if (iterate.call(context, item, index, obj, paths, parent, nodes)) {
        return {
          index: index,
          item: item,
          path: paths,
          items: obj,
          parent: parent,
          nodes: nodes
        };
      }
      if (parseChildren && item) {
        match = findTreeItem(item, item[parseChildren], iterate, context, paths.concat([parseChildren]), nodes, parseChildren, opts);
        if (match) {
          return match;
        }
      }
    }
  }
}

/**
  * 从树结构中查找匹配第一条数据的键、值、路径
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, items, path, parent, nodes) 回调
  * @param {Object} options {children: 'children'}
  * @param {Object} context 上下文
  * @return {Object} { item, index, items, path, parent, nodes }
  */
var findTree = helperCreateTreeFunc(findTreeItem);
module.exports = findTree;

/***/ }),

/***/ 4397:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var values = __webpack_require__(3656);

/**
  * 获取对象第一个值
  *
  * @param {Object} obj 对象/数组
  * @return {Object}
  */
function first(obj) {
  return values(obj)[0];
}
module.exports = first;

/***/ }),

/***/ 7709:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isArray = __webpack_require__(1297);
var arrayEach = __webpack_require__(1418);
function flattenDeep(array, deep) {
  var result = [];
  arrayEach(array, function (vals) {
    result = result.concat(isArray(vals) ? deep ? flattenDeep(vals, deep) : vals : [vals]);
  });
  return result;
}

/**
  * 将一个多维数组铺平
  * @param {Array} array 数组
  * @param {Boolean} deep 是否深层
  * @return {Array}
  */
function flatten(array, deep) {
  if (isArray(array)) {
    return flattenDeep(array, deep);
  }
  return [];
}
module.exports = flatten;

/***/ }),

/***/ 8792:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateMathNumber = __webpack_require__(2148);

/**
 * 将数值向下舍入
 *
 * @param {string|number} num 数值
 * @param {number} digits 小数保留位数
 * @return {number}
 */
var floor = helperCreateMathNumber('floor');
module.exports = floor;

/***/ }),

/***/ 4883:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isArray = __webpack_require__(1297);
var hasOwnProp = __webpack_require__(1692);

/**
  * 已废弃，被 some, every 替换
  * @deprecated
  */
function forOf(obj, iterate, context) {
  if (obj) {
    if (isArray(obj)) {
      for (var index = 0, len = obj.length; index < len; index++) {
        if (iterate.call(context, obj[index], index, obj) === false) {
          break;
        }
      }
    } else {
      for (var key in obj) {
        if (hasOwnProp(obj, key)) {
          if (iterate.call(context, obj[key], key, obj) === false) {
            break;
          }
        }
      }
    }
  }
}
module.exports = forOf;

/***/ }),

/***/ 4192:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticHGKeyRE = __webpack_require__(3941);
var helperGetHGSKeys = __webpack_require__(7374);
var hasOwnProp = __webpack_require__(1692);
var isUndefined = __webpack_require__(9139);
var eqNull = __webpack_require__(8878);

/**
 * 获取对象的属性的值，如果值为 undefined，则返回默认值
 * @param {Object/Array} obj 对象
 * @param {String/Function} property 键、路径
 * @param {Object} defaultValue 默认值
 * @return {Object}
 */
function get(obj, property, defaultValue) {
  if (eqNull(obj)) {
    return defaultValue;
  }
  var result = getValueByPath(obj, property);
  return isUndefined(result) ? defaultValue : result;
}
function getDeepProps(obj, key) {
  var matchs = key ? key.match(staticHGKeyRE) : '';
  return matchs ? matchs[1] ? obj[matchs[1]] ? obj[matchs[1]][matchs[2]] : undefined : obj[matchs[2]] : obj[key];
}
function getValueByPath(obj, property) {
  if (obj) {
    var rest, props, len;
    var index = 0;
    if (obj[property] || hasOwnProp(obj, property)) {
      return obj[property];
    } else {
      props = helperGetHGSKeys(property);
      len = props.length;
      if (len) {
        for (rest = obj; index < len; index++) {
          rest = getDeepProps(rest, props[index]);
          if (eqNull(rest)) {
            if (index === len - 1) {
              return rest;
            }
            return;
          }
        }
      }
      return rest;
    }
  }
}
module.exports = get;

/***/ }),

/***/ 5554:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticLocation = __webpack_require__(7522);
var helperGetLocatOrigin = __webpack_require__(9151);
var lastIndexOf = __webpack_require__(9262);
function getBaseURL() {
  if (staticLocation) {
    var pathname = staticLocation.pathname;
    var lastIndex = lastIndexOf(pathname, '/') + 1;
    return helperGetLocatOrigin() + (lastIndex === pathname.length ? pathname : pathname.substring(0, lastIndex));
  }
  return '';
}
module.exports = getBaseURL;

/***/ }),

/***/ 830:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperGetDateTime = __webpack_require__(4404);
var helperNewDate = __webpack_require__(2763);
var toStringDate = __webpack_require__(2214);
var isValidDate = __webpack_require__(8740);
var dateDiffRules = [['yyyy', 31536000000], ['MM', 2592000000], ['dd', 86400000], ['HH', 3600000], ['mm', 60000], ['ss', 1000], ['S', 0]];

/**
  * 返回两个日期之间差距,如果结束日期小于开始日期done为fasle
  *
  * @param {Date} startDate 开始日期
  * @param {Date} endDate 结束日期或当期日期
  * @return {Object}
  */
function getDateDiff(startDate, endDate) {
  var startTime, endTime, item, diffTime, len, index;
  var result = {
    done: false,
    time: 0
  };
  startDate = toStringDate(startDate);
  endDate = endDate ? toStringDate(endDate) : helperNewDate();
  if (isValidDate(startDate) && isValidDate(endDate)) {
    startTime = helperGetDateTime(startDate);
    endTime = helperGetDateTime(endDate);
    if (startTime < endTime) {
      diffTime = result.time = endTime - startTime;
      result.done = true;
      for (index = 0, len = dateDiffRules.length; index < len; index++) {
        item = dateDiffRules[index];
        if (diffTime >= item[1]) {
          if (index === len - 1) {
            result[item[0]] = diffTime || 0;
          } else {
            result[item[0]] = Math.floor(diffTime / item[1]);
            diffTime -= result[item[0]] * item[1];
          }
        } else {
          result[item[0]] = 0;
        }
      }
    }
  }
  return result;
}
module.exports = getDateDiff;

/***/ }),

/***/ 3869:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticDayTime = __webpack_require__(5766);
var staticStrFirst = __webpack_require__(2457);
var staticStrLast = __webpack_require__(7318);
var helperGetDateTime = __webpack_require__(4404);
var getWhatMonth = __webpack_require__(8483);
var toStringDate = __webpack_require__(2214);
var isValidDate = __webpack_require__(8740);

/**
  * 返回某个月份的天数
  *
  * @param {Date} date 日期或数字
  * @param {Number} offset 月(默认当月)、前几个月、后几个月
  * @return {Number}
  */
function getDayOfMonth(date, month) {
  date = toStringDate(date);
  if (isValidDate(date)) {
    return Math.floor((helperGetDateTime(getWhatMonth(date, month, staticStrLast)) - helperGetDateTime(getWhatMonth(date, month, staticStrFirst))) / staticDayTime) + 1;
  }
  return NaN;
}
module.exports = getDayOfMonth;

/***/ }),

/***/ 8873:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var getWhatYear = __webpack_require__(5985);
var toStringDate = __webpack_require__(2214);
var isValidDate = __webpack_require__(8740);
var isLeapYear = __webpack_require__(6191);

/**
  * 返回某个年份的天数
  *
  * @param {Date} date 日期或数字
  * @param {Number} offset 年(默认当年)、前几个年、后几个年
  * @return {Number}
  */
function getDayOfYear(date, year) {
  date = toStringDate(date);
  if (isValidDate(date)) {
    return isLeapYear(getWhatYear(date, year)) ? 366 : 365;
  }
  return NaN;
}
module.exports = getDayOfYear;

/***/ }),

/***/ 995:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateGetDateWeek = __webpack_require__(9013);

/**
  * 返回某个月的第几周
  *
  * @param {Date} date 日期或数字
  * @param {Number} firstDay 周视图的起始天，默认星期一
  * @return {Number}
  */
var getMonthWeek = helperCreateGetDateWeek(function (targetDate) {
  return new Date(targetDate.getFullYear(), targetDate.getMonth(), 1);
}, function (date1, date2) {
  return date1.getMonth() !== date2.getMonth();
});
module.exports = getMonthWeek;

/***/ }),

/***/ 1776:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isArray = __webpack_require__(1297);
var isString = __webpack_require__(3535);
var each = __webpack_require__(5360);

/**
  * 返回对象的长度
  *
  * @param {Object} obj 对象
  * @return {Number}
  */
function getSize(obj) {
  var len = 0;
  if (isString(obj) || isArray(obj)) {
    return obj.length;
  }
  each(obj, function () {
    len++;
  });
  return len;
}
module.exports = getSize;

/***/ }),

/***/ 6680:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isSymbol = __webpack_require__(3387);
var isDate = __webpack_require__(6602);
var isArray = __webpack_require__(1297);
var isRegExp = __webpack_require__(7211);
var isError = __webpack_require__(1875);
var isNull = __webpack_require__(7001);

/**
  * 获取对象类型
  *
  * @param {Object} obj 对象
  * @return {String}
  */
function getType(obj) {
  if (isNull(obj)) {
    return 'null';
  }
  if (isSymbol(obj)) {
    return 'symbol';
  }
  if (isDate(obj)) {
    return 'date';
  }
  if (isArray(obj)) {
    return 'array';
  }
  if (isRegExp(obj)) {
    return 'regexp';
  }
  if (isError(obj)) {
    return 'error';
  }
  return typeof obj;
}
module.exports = getType;

/***/ }),

/***/ 1522:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticStrFirst = __webpack_require__(2457);
var staticStrLast = __webpack_require__(7318);
var staticParseInt = __webpack_require__(7524);
var helperGetDateFullYear = __webpack_require__(5919);
var helperGetDateMonth = __webpack_require__(3489);
var helperGetDateTime = __webpack_require__(4404);
var toStringDate = __webpack_require__(2214);
var isValidDate = __webpack_require__(8740);

/**
  * 返回前几天或后几天的日期
  *
  * @param {Date} date 日期或数字
  * @param {Number} offset 天(默认当天)、前几天、后几天
  * @param {String} mode 获取时分秒(null默认当前时分秒)、日初(first)、日末(last)
  * @return {Date}
  */
function getWhatDay(date, offset, mode) {
  date = toStringDate(date);
  if (isValidDate(date) && !isNaN(offset)) {
    date.setDate(date.getDate() + staticParseInt(offset));
    if (mode === staticStrFirst) {
      return new Date(helperGetDateFullYear(date), helperGetDateMonth(date), date.getDate());
    } else if (mode === staticStrLast) {
      return new Date(helperGetDateTime(getWhatDay(date, 1, staticStrFirst)) - 1);
    }
  }
  return date;
}
module.exports = getWhatDay;

/***/ }),

/***/ 8483:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticStrFirst = __webpack_require__(2457);
var staticStrLast = __webpack_require__(7318);
var staticDayTime = __webpack_require__(5766);
var helperGetDateFullYear = __webpack_require__(5919);
var helperGetDateTime = __webpack_require__(4404);
var helperGetDateMonth = __webpack_require__(3489);
var toStringDate = __webpack_require__(2214);
var isValidDate = __webpack_require__(8740);
var isNumber = __webpack_require__(504);

/**
  * 返回前几月或后几月的日期
  *
  * @param {Date} date 日期或数字
  * @param {Number} offsetMonth 月(默认当前月)、前几个月、后几个月
  * @param {Number/String} offsetDay 获取哪天：月初(first)、月末(last)、指定天数(数值)，如果为空，但超过指定月份的天数时，则默认单月最后一天
  * @return {Date}
  */
function getWhatMonth(date, offsetMonth, offsetDay) {
  var monthNum = offsetMonth && !isNaN(offsetMonth) ? offsetMonth : 0;
  date = toStringDate(date);
  if (isValidDate(date)) {
    if (offsetDay === staticStrFirst) {
      return new Date(helperGetDateFullYear(date), helperGetDateMonth(date) + monthNum, 1);
    } else if (offsetDay === staticStrLast) {
      return new Date(helperGetDateTime(getWhatMonth(date, monthNum + 1, staticStrFirst)) - 1);
    } else if (isNumber(offsetDay)) {
      date.setDate(offsetDay);
    }
    if (monthNum) {
      var currDate = date.getDate();
      date.setMonth(helperGetDateMonth(date) + monthNum);
      if (currDate !== date.getDate()) {
        // 当为指定天数，且被跨月了，则默认单月最后一天
        date.setDate(1);
        return new Date(helperGetDateTime(date) - staticDayTime);
      }
    }
  }
  return date;
}
module.exports = getWhatMonth;

/***/ }),

/***/ 6228:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var getWhatMonth = __webpack_require__(8483);
var toStringDate = __webpack_require__(2214);
var isValidDate = __webpack_require__(8740);
function getQuarterNumber(date) {
  var month = date.getMonth();
  if (month < 3) {
    return 1;
  } else if (month < 6) {
    return 2;
  } else if (month < 9) {
    return 3;
  }
  return 4;
}

/**
  * 返回前几季度或后几季度的日期
  *
  * @param {Date} date 日期
  * @param {Number} offset 季度(默认当前季度)、前几季度、后几季度
  * @param {Number} day 获取哪天：月初(first)、月末(last)、指定天数(数值)，如果为空，但超过指定月份的天数时，则默认单月最后一天
  * @return {Date}
  */
function getWhatQuarter(date, offset, day) {
  var currMonth,
    monthOffset = offset && !isNaN(offset) ? offset * 3 : 0;
  date = toStringDate(date);
  if (isValidDate(date)) {
    currMonth = (getQuarterNumber(date) - 1) * 3;
    date.setMonth(currMonth);
    return getWhatMonth(date, monthOffset, day);
  }
  return date;
}
module.exports = getWhatQuarter;

/***/ }),

/***/ 4466:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var setupDefaults = __webpack_require__(1450);
var staticDayTime = __webpack_require__(5766);
var staticWeekTime = __webpack_require__(9061);
var helperGetDateTime = __webpack_require__(4404);
var toStringDate = __webpack_require__(2214);
var isValidDate = __webpack_require__(8740);
var isNumber = __webpack_require__(504);

/**
  * 返回前几周或后几周的星期几
  *
  * @param {Date} date 日期
  * @param {Number} offsetWeek 周(默认当前周)、前几周、后几周
  * @param {Number} offsetDay 星期天(默认0)、星期一(1)、星期二(2)、星期三(3)、星期四(4)、星期五(5)、星期六(6)
  * @param {Number} firstDay 周视图的起始天，默认星期一
  * @return {Date}
  */
function getWhatWeek(date, offsetWeek, offsetDay, firstDay) {
  date = toStringDate(date);
  if (isValidDate(date)) {
    var hasCustomDay = isNumber(offsetDay);
    var hasStartDay = isNumber(firstDay);
    var whatDayTime = helperGetDateTime(date);
    // 如果指定了天或周视图起始天
    if (hasCustomDay || hasStartDay) {
      var viewStartDay = hasStartDay ? firstDay : setupDefaults.firstDayOfWeek;
      var currentDay = date.getDay();
      var customDay = hasCustomDay ? offsetDay : currentDay;
      if (currentDay !== customDay) {
        var offsetNum = 0;
        if (viewStartDay > currentDay) {
          offsetNum = -(7 - viewStartDay + currentDay);
        } else if (viewStartDay < currentDay) {
          offsetNum = viewStartDay - currentDay;
        }
        if (customDay > viewStartDay) {
          whatDayTime += ((customDay === 0 ? 7 : customDay) - viewStartDay + offsetNum) * staticDayTime;
        } else if (customDay < viewStartDay) {
          whatDayTime += (7 - viewStartDay + customDay + offsetNum) * staticDayTime;
        } else {
          whatDayTime += offsetNum * staticDayTime;
        }
      }
    }
    if (offsetWeek && !isNaN(offsetWeek)) {
      whatDayTime += offsetWeek * staticWeekTime;
    }
    return new Date(whatDayTime);
  }
  return date;
}
module.exports = getWhatWeek;

/***/ }),

/***/ 5985:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticStrFirst = __webpack_require__(2457);
var staticStrLast = __webpack_require__(7318);
var helperGetDateFullYear = __webpack_require__(5919);
var getWhatMonth = __webpack_require__(8483);
var toStringDate = __webpack_require__(2214);
var isValidDate = __webpack_require__(8740);

/**
  * 返回前几年或后几年的日期
  *
  * @param {Date} date 日期或数字
  * @param {Number} offset 年(默认当前年)、前几个年(数值)、后几个年(数值)
  * @param {Number/String} month 获取哪月(null默认当前年)、年初(first)、年末(last)、指定月份（0-11）
  * @return {Date}
  */
function getWhatYear(date, offset, month) {
  var number;
  date = toStringDate(date);
  if (isValidDate(date)) {
    if (offset) {
      number = offset && !isNaN(offset) ? offset : 0;
      date.setFullYear(helperGetDateFullYear(date) + number);
    }
    if (month || !isNaN(month)) {
      if (month === staticStrFirst) {
        return new Date(helperGetDateFullYear(date), 0, 1);
      } else if (month === staticStrLast) {
        date.setMonth(11);
        return getWhatMonth(date, 0, staticStrLast);
      } else {
        date.setMonth(month);
      }
    }
  }
  return date;
}
module.exports = getWhatYear;

/***/ }),

/***/ 3549:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticDayTime = __webpack_require__(5766);
var staticStrFirst = __webpack_require__(2457);
var helperGetYMDTime = __webpack_require__(5061);
var getWhatYear = __webpack_require__(5985);
var toStringDate = __webpack_require__(2214);
var isValidDate = __webpack_require__(8740);

/**
  * 返回某个年份的第几天
  *
  * @param {Date} date 日期或数字
  * @return {Number}
  */
function getYearDay(date) {
  date = toStringDate(date);
  if (isValidDate(date)) {
    return Math.floor((helperGetYMDTime(date) - helperGetYMDTime(getWhatYear(date, 0, staticStrFirst))) / staticDayTime) + 1;
  }
  return NaN;
}
module.exports = getYearDay;

/***/ }),

/***/ 9564:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateGetDateWeek = __webpack_require__(9013);

/**
  * 返回某个年份的第几周
  *
  * @param {Date} date 日期或数字
  * @param {Number} firstDay 从年初的星期几为起始开始周开始算，默认星期一
  * @return {Number}
  */
var getYearWeek = helperCreateGetDateWeek(function (targetDate) {
  return new Date(targetDate.getFullYear(), 0, 1);
}, function (date1, date2) {
  return date1.getFullYear() !== date2.getFullYear();
});
module.exports = getYearWeek;

/***/ }),

/***/ 1559:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isEmpty = __webpack_require__(7141);
var isObject = __webpack_require__(8840);
var isFunction = __webpack_require__(7379);
var property = __webpack_require__(7160);
var each = __webpack_require__(5360);
function createiterateEmpty(iterate) {
  return function () {
    return isEmpty(iterate);
  };
}

/**
  * 集合分组,默认使用键值分组,如果有iterate则使用结果进行分组
  *
  * @param {Array} obj 对象
  * @param {Function} iterate 回调/对象属性
  * @param {Object} context 上下文
  * @return {Object}
  */
function groupBy(obj, iterate, context) {
  var groupKey;
  var result = {};
  if (obj) {
    if (iterate && isObject(iterate)) {
      iterate = createiterateEmpty(iterate);
    } else if (!isFunction(iterate)) {
      iterate = property(iterate);
    }
    each(obj, function (val, key) {
      groupKey = iterate ? iterate.call(context, val, key, obj) : val;
      if (result[groupKey]) {
        result[groupKey].push(val);
      } else {
        result[groupKey] = [val];
      }
    });
  }
  return result;
}
module.exports = groupBy;

/***/ }),

/***/ 2298:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticHGKeyRE = __webpack_require__(3941);
var helperGetHGSKeys = __webpack_require__(7374);
var hasOwnProp = __webpack_require__(1692);

/**
 * 检查键、路径是否是该对象的属性
 *
 * @param {Object/Array} data 对象
 * @param {String/Function} property 键、路径
 * @return {Boolean}
 */
function has(obj, property) {
  if (obj) {
    if (hasOwnProp(obj, property)) {
      return true;
    } else {
      var prop, arrIndex, objProp, matchs, rest, isHas;
      var props = helperGetHGSKeys(property);
      var index = 0;
      var len = props.length;
      for (rest = obj; index < len; index++) {
        isHas = false;
        prop = props[index];
        matchs = prop ? prop.match(staticHGKeyRE) : '';
        if (matchs) {
          arrIndex = matchs[1];
          objProp = matchs[2];
          if (arrIndex) {
            if (rest[arrIndex]) {
              if (hasOwnProp(rest[arrIndex], objProp)) {
                isHas = true;
                rest = rest[arrIndex][objProp];
              }
            }
          } else {
            if (hasOwnProp(rest, objProp)) {
              isHas = true;
              rest = rest[objProp];
            }
          }
        } else {
          if (hasOwnProp(rest, prop)) {
            isHas = true;
            rest = rest[prop];
          }
        }
        if (isHas) {
          if (index === len - 1) {
            return true;
          }
        } else {
          break;
        }
      }
    }
  }
  return false;
}
module.exports = has;

/***/ }),

/***/ 1692:
/***/ ((module) => {

/**
  * 判断对象自身属性中是否具有指定的属性
  *
  * @param {Object} obj 对象
  * @param {String/Number} key 键值
  * @return {Boolean}
  */
function hasOwnProp(obj, key) {
  return obj && obj.hasOwnProperty ? obj.hasOwnProperty(key) : false;
}
module.exports = hasOwnProp;

/***/ }),

/***/ 9013:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var setupDefaults = __webpack_require__(1450);
var staticDayTime = __webpack_require__(5766);
var staticWeekTime = __webpack_require__(9061);
var isNumber = __webpack_require__(504);
var includes = __webpack_require__(9916);
var toStringDate = __webpack_require__(2214);
var isValidDate = __webpack_require__(8740);
var getWhatWeek = __webpack_require__(4466);
var range = __webpack_require__(1461);
var map = __webpack_require__(9660);
var helperGetDateTime = __webpack_require__(4404);
var nextStartMaps = map(range(0, 7), function (day) {
  return [(day + 1) % 7, (day + 2) % 7, (day + 3) % 7];
});
function matchWeekStartDay(time, viewStartDay) {
  var day = new Date(time).getDay();
  return includes(nextStartMaps[viewStartDay], day);
}
function helperCreateGetDateWeek(getStartDate, checkCrossDate) {
  return function (date, firstDay) {
    var viewStartDay = isNumber(firstDay) ? firstDay : setupDefaults.firstDayOfWeek;
    var targetDate = toStringDate(date);
    if (isValidDate(targetDate)) {
      var targetWeekStartDate = getWhatWeek(targetDate, 0, viewStartDay, viewStartDay);
      var firstDate = getStartDate(targetWeekStartDate);
      var firstTime = helperGetDateTime(firstDate);
      var targetWeekStartTime = helperGetDateTime(targetWeekStartDate);
      var targetWeekEndTime = targetWeekStartTime + staticDayTime * 6;
      var targetWeekEndDate = new Date(targetWeekEndTime);
      var firstWeekStartDate = getWhatWeek(firstDate, 0, viewStartDay, viewStartDay);
      var firstWeekStartTime = helperGetDateTime(firstWeekStartDate);
      if (targetWeekStartTime === firstWeekStartTime) {
        return 1;
      }
      var tempTime;
      if (checkCrossDate(targetWeekStartDate, targetWeekEndDate)) {
        tempTime = helperGetDateTime(getStartDate(targetWeekEndDate));
        for (; tempTime < targetWeekEndTime; tempTime += staticDayTime) {
          if (matchWeekStartDay(tempTime, viewStartDay)) {
            return 1;
          }
        }
      }
      var firstWeekEndTime = firstWeekStartTime + staticDayTime * 6;
      var firstWeekEndDate = new Date(targetWeekEndTime);
      var offsetNum = 1;
      if (checkCrossDate(firstWeekStartDate, firstWeekEndDate)) {
        offsetNum = 0;
        tempTime = firstTime;
        for (; tempTime < firstWeekEndTime; tempTime += staticDayTime) {
          if (matchWeekStartDay(tempTime, viewStartDay)) {
            offsetNum++;
            break;
          }
        }
      }
      return Math.floor((targetWeekStartTime - firstWeekStartTime) / staticWeekTime) + offsetNum;
    }
    return NaN;
  };
}
module.exports = helperCreateGetDateWeek;

/***/ }),

/***/ 1137:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var each = __webpack_require__(5360);
function helperCreateGetObjects(name, getIndex) {
  var proMethod = Object[name];
  return function (obj) {
    var result = [];
    if (obj) {
      if (proMethod) {
        return proMethod(obj);
      }
      each(obj, getIndex > 1 ? function (key) {
        result.push(['' + key, obj[key]]);
      } : function () {
        result.push(arguments[getIndex]);
      });
    }
    return result;
  };
}
module.exports = helperCreateGetObjects;

/***/ }),

/***/ 6438:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var objectToString = __webpack_require__(1081);
function helperCreateInInObjectString(type) {
  return function (obj) {
    return '[object ' + type + ']' === objectToString.call(obj);
  };
}
module.exports = helperCreateInInObjectString;

/***/ }),

/***/ 1198:
/***/ ((module) => {

/* eslint-disable valid-typeof */
function helperCreateInTypeof(type) {
  return function (obj) {
    return typeof obj === type;
  };
}
module.exports = helperCreateInTypeof;

/***/ }),

/***/ 6803:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isArray = __webpack_require__(1297);
var isString = __webpack_require__(3535);
var hasOwnProp = __webpack_require__(1692);
function helperCreateIndexOf(name, callback) {
  return function (obj, val) {
    if (obj) {
      if (obj[name]) {
        return obj[name](val);
      }
      if (isString(obj) || isArray(obj)) {
        return callback(obj, val);
      }
      for (var key in obj) {
        if (hasOwnProp(obj, key)) {
          if (val === obj[key]) {
            return key;
          }
        }
      }
    }
    return -1;
  };
}
module.exports = helperCreateIndexOf;

/***/ }),

/***/ 7889:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var hasOwnProp = __webpack_require__(1692);
var isArray = __webpack_require__(1297);
function helperCreateIterateHandle(prop, useArray, restIndex, matchValue, defaultValue) {
  return function (obj, iterate, context) {
    if (obj && iterate) {
      if (prop && obj[prop]) {
        return obj[prop](iterate, context);
      } else {
        if (useArray && isArray(obj)) {
          for (var index = 0, len = obj.length; index < len; index++) {
            if (!!iterate.call(context, obj[index], index, obj) === matchValue) {
              return [true, false, index, obj[index]][restIndex];
            }
          }
        } else {
          for (var key in obj) {
            if (hasOwnProp(obj, key)) {
              if (!!iterate.call(context, obj[key], key, obj) === matchValue) {
                return [true, false, key, obj[key]][restIndex];
              }
            }
          }
        }
      }
    }
    return defaultValue;
  };
}
module.exports = helperCreateIterateHandle;

/***/ }),

/***/ 2148:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperMultiply = __webpack_require__(4968);
var toNumber = __webpack_require__(2661);
var toNumberString = __webpack_require__(9730);
function helperCreateMathNumber(name) {
  return function (num, digits) {
    var numRest = toNumber(num);
    var rest = numRest;
    if (numRest) {
      digits = digits >> 0;
      var numStr = toNumberString(numRest);
      var nums = numStr.split('.');
      var intStr = nums[0];
      var floatStr = nums[1] || '';
      var fStr = floatStr.substring(0, digits + 1);
      var subRest = intStr + (fStr ? '.' + fStr : '');
      if (digits >= floatStr.length) {
        return toNumber(subRest);
      }
      subRest = numRest;
      if (digits > 0) {
        var ratio = Math.pow(10, digits);
        rest = Math[name](helperMultiply(subRest, ratio)) / ratio;
      } else {
        rest = Math[name](subRest);
      }
    }
    return rest;
  };
}
module.exports = helperCreateMathNumber;

/***/ }),

/***/ 9434:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isFunction = __webpack_require__(7379);
var eqNull = __webpack_require__(8878);
var get = __webpack_require__(4192);
var arrayEach = __webpack_require__(1418);
function helperCreateMinMax(handle) {
  return function (arr, iterate) {
    if (arr && arr.length) {
      var rest, itemIndex;
      arrayEach(arr, function (itemVal, index) {
        if (iterate) {
          itemVal = isFunction(iterate) ? iterate(itemVal, index, arr) : get(itemVal, iterate);
        }
        if (!eqNull(itemVal) && (eqNull(rest) || handle(rest, itemVal))) {
          itemIndex = index;
          rest = itemVal;
        }
      });
      return arr[itemIndex];
    }
    return rest;
  };
}
module.exports = helperCreateMinMax;

/***/ }),

/***/ 526:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isFunction = __webpack_require__(7379);
var isArray = __webpack_require__(1297);
var each = __webpack_require__(5360);
var findIndexOf = __webpack_require__(6655);
function helperCreatePickOmit(case1, case2) {
  return function (obj, callback) {
    var item, index;
    var rest = {};
    var result = [];
    var context = this;
    var args = arguments;
    var len = args.length;
    if (!isFunction(callback)) {
      for (index = 1; index < len; index++) {
        item = args[index];
        result.push.apply(result, isArray(item) ? item : [item]);
      }
      callback = 0;
    }
    each(obj, function (val, key) {
      if ((callback ? callback.call(context, val, key, obj) : findIndexOf(result, function (name) {
        return name === key;
      }) > -1) ? case1 : case2) {
        rest[key] = val;
      }
    });
    return rest;
  };
}
module.exports = helperCreatePickOmit;

/***/ }),

/***/ 2011:
/***/ ((module) => {

function helperCreateToNumber(handle) {
  return function (str) {
    if (str) {
      var num = handle(str && str.replace ? str.replace(/,/g, '') : str);
      if (!isNaN(num)) {
        return num;
      }
    }
    return 0;
  };
}
module.exports = helperCreateToNumber;

/***/ }),

/***/ 5366:
/***/ ((module) => {

function helperCreateTreeFunc(handle) {
  return function (obj, iterate, options, context) {
    var opts = options || {};
    var optChildren = opts.children || 'children';
    return handle(null, obj, iterate, context, [], [], optChildren, opts);
  };
}
module.exports = helperCreateTreeFunc;

/***/ }),

/***/ 3091:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isFunction = __webpack_require__(7379);
var isString = __webpack_require__(3535);
var isArray = __webpack_require__(1297);
var hasOwnProp = __webpack_require__(1692);
function helperCreateiterateIndexOf(callback) {
  return function (obj, iterate, context) {
    if (obj && isFunction(iterate)) {
      if (isArray(obj) || isString(obj)) {
        return callback(obj, iterate, context);
      }
      for (var key in obj) {
        if (hasOwnProp(obj, key)) {
          if (iterate.call(context, obj[key], key, obj)) {
            return key;
          }
        }
      }
    }
    return -1;
  };
}
module.exports = helperCreateiterateIndexOf;

/***/ }),

/***/ 549:
/***/ ((module) => {

function helperDefaultCompare(v1, v2) {
  return v1 === v2;
}
module.exports = helperDefaultCompare;

/***/ }),

/***/ 7203:
/***/ ((module) => {

function helperDeleteProperty(obj, property) {
  try {
    delete obj[property];
  } catch (e) {
    obj[property] = undefined;
  }
}
module.exports = helperDeleteProperty;

/***/ }),

/***/ 8407:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isNumber = __webpack_require__(504);
var isArray = __webpack_require__(1297);
var isString = __webpack_require__(3535);
var isRegExp = __webpack_require__(7211);
var isDate = __webpack_require__(6602);
var isBoolean = __webpack_require__(9439);
var isUndefined = __webpack_require__(9139);
var keys = __webpack_require__(1762);
var every = __webpack_require__(753);
function helperEqualCompare(val1, val2, compare, func, key, obj1, obj2) {
  if (val1 === val2) {
    return true;
  }
  if (val1 && val2 && !isNumber(val1) && !isNumber(val2) && !isString(val1) && !isString(val2)) {
    if (isRegExp(val1)) {
      return compare('' + val1, '' + val2, key, obj1, obj2);
    }
    if (isDate(val1) || isBoolean(val1)) {
      return compare(+val1, +val2, key, obj1, obj2);
    } else {
      var result, val1Keys, val2Keys;
      var isObj1Arr = isArray(val1);
      var isObj2Arr = isArray(val2);
      if (isObj1Arr || isObj2Arr ? isObj1Arr && isObj2Arr : val1.constructor === val2.constructor) {
        val1Keys = keys(val1);
        val2Keys = keys(val2);
        if (func) {
          result = func(val1, val2, key);
        }
        if (val1Keys.length === val2Keys.length) {
          return isUndefined(result) ? every(val1Keys, function (key, index) {
            return key === val2Keys[index] && helperEqualCompare(val1[key], val2[val2Keys[index]], compare, func, isObj1Arr || isObj2Arr ? index : key, val1, val2);
          }) : !!result;
        }
        return false;
      }
    }
  }
  return compare(val1, val2, key, obj1, obj2);
}
module.exports = helperEqualCompare;

/***/ }),

/***/ 3277:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var toValueString = __webpack_require__(6220);
var keys = __webpack_require__(1762);
function helperFormatEscaper(dataMap) {
  var replaceRegexp = new RegExp('(?:' + keys(dataMap).join('|') + ')', 'g');
  return function (str) {
    return toValueString(str).replace(replaceRegexp, function (match) {
      return dataMap[match];
    });
  };
}
module.exports = helperFormatEscaper;

/***/ }),

/***/ 5919:
/***/ ((module) => {

function helperGetDateFullYear(date) {
  return date.getFullYear();
}
module.exports = helperGetDateFullYear;

/***/ }),

/***/ 3489:
/***/ ((module) => {

function helperGetDateMonth(date) {
  return date.getMonth();
}
module.exports = helperGetDateMonth;

/***/ }),

/***/ 4404:
/***/ ((module) => {

function helperGetDateTime(date) {
  return date.getTime();
}
module.exports = helperGetDateTime;

/***/ }),

/***/ 7374:
/***/ ((module) => {

function helperGetHGSKeys(property) {
  // 以最快的方式判断数组，可忽略准确性
  return property ? property.splice && property.join ? property : ('' + property).replace(/(\[\d+\])\.?/g, '$1.').replace(/\.$/, '').split('.') : [];
}
module.exports = helperGetHGSKeys;

/***/ }),

/***/ 9151:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticLocation = __webpack_require__(7522);
function helperGetLocatOrigin() {
  return staticLocation ? staticLocation.origin || staticLocation.protocol + '//' + staticLocation.host : '';
}
module.exports = helperGetLocatOrigin;

/***/ }),

/***/ 28:
/***/ ((module) => {

function helperGetUTCDateTime(resMaps) {
  return Date.UTC(resMaps.y, resMaps.M || 0, resMaps.d || 1, resMaps.H || 0, resMaps.m || 0, resMaps.s || 0, resMaps.S || 0);
}
module.exports = helperGetUTCDateTime;

/***/ }),

/***/ 2974:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperGetDateFullYear = __webpack_require__(5919);
var helperGetDateMonth = __webpack_require__(3489);
function helperGetYMD(date) {
  return new Date(helperGetDateFullYear(date), helperGetDateMonth(date), date.getDate());
}
module.exports = helperGetYMD;

/***/ }),

/***/ 5061:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperGetDateTime = __webpack_require__(4404);
var helperGetYMD = __webpack_require__(2974);
function helperGetYMDTime(date) {
  return helperGetDateTime(helperGetYMD(date));
}
module.exports = helperGetYMDTime;

/***/ }),

/***/ 4968:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperNumberDecimal = __webpack_require__(2591);
var toNumberString = __webpack_require__(9730);
function helperMultiply(multiplier, multiplicand) {
  var str1 = toNumberString(multiplier);
  var str2 = toNumberString(multiplicand);
  return parseInt(str1.replace('.', '')) * parseInt(str2.replace('.', '')) / Math.pow(10, helperNumberDecimal(str1) + helperNumberDecimal(str2));
}
module.exports = helperMultiply;

/***/ }),

/***/ 2763:
/***/ ((module) => {

function helperNewDate() {
  return new Date();
}
module.exports = helperNewDate;

/***/ }),

/***/ 2:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperNumberDecimal = __webpack_require__(2591);
var toNumberString = __webpack_require__(9730);
var multiply = __webpack_require__(939);
function helperNumberAdd(addend, augend) {
  var str1 = toNumberString(addend);
  var str2 = toNumberString(augend);
  var ratio = Math.pow(10, Math.max(helperNumberDecimal(str1), helperNumberDecimal(str2)));
  return (multiply(addend, ratio) + multiply(augend, ratio)) / ratio;
}
module.exports = helperNumberAdd;

/***/ }),

/***/ 2591:
/***/ ((module) => {

function helperNumberDecimal(numStr) {
  return (numStr.split('.')[1] || '').length;
}
module.exports = helperNumberDecimal;

/***/ }),

/***/ 436:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperNumberDecimal = __webpack_require__(2591);
var toNumberString = __webpack_require__(9730);
var multiply = __webpack_require__(939);
function helperNumberDivide(divisor, dividend) {
  var str1 = toNumberString(divisor);
  var str2 = toNumberString(dividend);
  var divisorDecimal = helperNumberDecimal(str1);
  var dividendDecimal = helperNumberDecimal(str2);
  var powY = dividendDecimal - divisorDecimal;
  var isMinus = powY < 0;
  var multiplicand = Math.pow(10, isMinus ? Math.abs(powY) : powY);
  return multiply(str1.replace('.', '') / str2.replace('.', ''), isMinus ? 1 / multiplicand : multiplicand);
}
module.exports = helperNumberDivide;

/***/ }),

/***/ 2261:
/***/ ((module) => {

function helperNumberOffsetPoint(str, offsetIndex) {
  return str.substring(0, offsetIndex) + '.' + str.substring(offsetIndex, str.length);
}
module.exports = helperNumberOffsetPoint;

/***/ }),

/***/ 4039:
/***/ ((module) => {

function helperStringLowerCase(str) {
  return str.toLowerCase();
}
module.exports = helperStringLowerCase;

/***/ }),

/***/ 7388:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticParseInt = __webpack_require__(7524);
function helperStringRepeat(str, count) {
  if (str.repeat) {
    return str.repeat(count);
  }
  var list = isNaN(count) ? [] : new Array(staticParseInt(count));
  return list.join(str) + (list.length > 0 ? str : '');
}
module.exports = helperStringRepeat;

/***/ }),

/***/ 8461:
/***/ ((module) => {

function helperStringSubstring(str, start, end) {
  return str.substring(start, end);
}
module.exports = helperStringSubstring;

/***/ }),

/***/ 9523:
/***/ ((module) => {

function helperStringUpperCase(str) {
  return str.toUpperCase();
}
module.exports = helperStringUpperCase;

/***/ }),

/***/ 4862:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isArray = __webpack_require__(1297);
var includes = __webpack_require__(9916);

/**
  * 判断数组是否包含另一数组
  *
  * @param {Array} array1 数组
  * @param {Array} array2 被包含数组
  * @return {Boolean}
  */
function includeArrays(array1, array2) {
  var len;
  var index = 0;
  if (isArray(array1) && isArray(array2)) {
    for (len = array2.length; index < len; index++) {
      if (!includes(array1, array2[index])) {
        return false;
      }
    }
    return true;
  }
  return includes(array1, array2);
}
module.exports = includeArrays;

/***/ }),

/***/ 9916:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var hasOwnProp = __webpack_require__(1692);

/**
  * 判断对象是否包含该值,成功返回true否则false
  *
  * @param {Object} obj 对象
  * @param {Object} val 值
  * @return {Boolean}
  */
function includes(obj, val) {
  if (obj) {
    if (obj.includes) {
      return obj.includes(val);
    }
    for (var key in obj) {
      if (hasOwnProp(obj, key)) {
        if (val === obj[key]) {
          return true;
        }
      }
    }
  }
  return false;
}
module.exports = includes;

/***/ }),

/***/ 8961:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


// 核心
var XEUtils = __webpack_require__(2810);

// 对象相关的方法
var assign = __webpack_require__(1524);
var objectEach = __webpack_require__(8480);
var lastObjectEach = __webpack_require__(7197);
var objectMap = __webpack_require__(8333);
var merge = __webpack_require__(2950);

// 数组相关的方法
var map = __webpack_require__(9660);
var some = __webpack_require__(8815);
var every = __webpack_require__(753);
var includeArrays = __webpack_require__(4862);
var arrayEach = __webpack_require__(1418);
var lastArrayEach = __webpack_require__(8854);
var uniq = __webpack_require__(3755);
var union = __webpack_require__(5628);
var toArray = __webpack_require__(423);
var sortBy = __webpack_require__(1969);
var orderBy = __webpack_require__(9891);
var shuffle = __webpack_require__(7467);
var sample = __webpack_require__(5380);
var slice = __webpack_require__(2616);
var filter = __webpack_require__(6881);
var findKey = __webpack_require__(747);
var includes = __webpack_require__(9916);
var find = __webpack_require__(5491);
var findLast = __webpack_require__(4281);
var reduce = __webpack_require__(3743);
var copyWithin = __webpack_require__(8529);
var chunk = __webpack_require__(310);
var zip = __webpack_require__(6581);
var unzip = __webpack_require__(9627);
var zipObject = __webpack_require__(478);
var flatten = __webpack_require__(7709);
var pluck = __webpack_require__(624);
var invoke = __webpack_require__(8519);
var toArrayTree = __webpack_require__(4600);
var toTreeArray = __webpack_require__(5812);
var findTree = __webpack_require__(6463);
var eachTree = __webpack_require__(2312);
var mapTree = __webpack_require__(194);
var filterTree = __webpack_require__(5451);
var searchTree = __webpack_require__(27);
var arrayIndexOf = __webpack_require__(592);
var arrayLastIndexOf = __webpack_require__(3920);

// 基础方法
var hasOwnProp = __webpack_require__(1692);
var isArray = __webpack_require__(1297);
var isNull = __webpack_require__(7001);
var isNumberNaN = __webpack_require__(5633);
var isUndefined = __webpack_require__(9139);
var isFunction = __webpack_require__(7379);
var isObject = __webpack_require__(8840);
var isString = __webpack_require__(3535);
var isPlainObject = __webpack_require__(7143);
var isLeapYear = __webpack_require__(6191);
var isDate = __webpack_require__(6602);
var eqNull = __webpack_require__(8878);
var each = __webpack_require__(5360);
var forOf = __webpack_require__(4883);
var lastForOf = __webpack_require__(3244);
var indexOf = __webpack_require__(9444);
var lastIndexOf = __webpack_require__(9262);
var keys = __webpack_require__(1762);
var values = __webpack_require__(3656);
var clone = __webpack_require__(1696);
var getSize = __webpack_require__(1776);
var lastEach = __webpack_require__(1636);
var remove = __webpack_require__(4520);
var clear = __webpack_require__(2095);
var isNumberFinite = __webpack_require__(3707);
var isFloat = __webpack_require__(9591);
var isInteger = __webpack_require__(9424);
var isBoolean = __webpack_require__(9439);
var isNumber = __webpack_require__(504);
var isRegExp = __webpack_require__(7211);
var isError = __webpack_require__(1875);
var isTypeError = __webpack_require__(186);
var isEmpty = __webpack_require__(7141);
var isSymbol = __webpack_require__(3387);
var isArguments = __webpack_require__(9175);
var isElement = __webpack_require__(8433);
var isDocument = __webpack_require__(8791);
var isWindow = __webpack_require__(3427);
var isFormData = __webpack_require__(7998);
var isMap = __webpack_require__(7238);
var isWeakMap = __webpack_require__(3026);
var isSet = __webpack_require__(6742);
var isWeakSet = __webpack_require__(8200);
var isMatch = __webpack_require__(6238);
var isEqual = __webpack_require__(3145);
var isEqualWith = __webpack_require__(3559);
var getType = __webpack_require__(6680);
var uniqueId = __webpack_require__(9995);
var findIndexOf = __webpack_require__(6655);
var findLastIndexOf = __webpack_require__(1398);
var toStringJSON = __webpack_require__(3413);
var toJSONString = __webpack_require__(6769);
var entries = __webpack_require__(6989);
var pick = __webpack_require__(2334);
var omit = __webpack_require__(3168);
var first = __webpack_require__(4397);
var last = __webpack_require__(1661);
var has = __webpack_require__(2298);
var get = __webpack_require__(4192);
var set = __webpack_require__(6069);
var groupBy = __webpack_require__(1559);
var countBy = __webpack_require__(2665);
var range = __webpack_require__(1461);
var destructuring = __webpack_require__(3693);

// 数值相关方法
var random = __webpack_require__(3106);
var max = __webpack_require__(4475);
var min = __webpack_require__(1024);
var commafy = __webpack_require__(9987);
var round = __webpack_require__(3221);
var ceil = __webpack_require__(2293);
var floor = __webpack_require__(8792);
var toFixed = __webpack_require__(6854);
var toInteger = __webpack_require__(1212);
var toNumber = __webpack_require__(2661);
var toNumberString = __webpack_require__(9730);
var add = __webpack_require__(2389);
var subtract = __webpack_require__(4875);
var multiply = __webpack_require__(939);
var divide = __webpack_require__(8685);
var sum = __webpack_require__(5515);
var mean = __webpack_require__(1790);

// 日期相关的方法
var getWhatYear = __webpack_require__(5985);
var getWhatQuarter = __webpack_require__(6228);
var getWhatMonth = __webpack_require__(8483);
var getWhatDay = __webpack_require__(1522);
var toStringDate = __webpack_require__(2214);
var toDateString = __webpack_require__(7670);
var now = __webpack_require__(3050);
var timestamp = __webpack_require__(5473);
var isValidDate = __webpack_require__(8740);
var isDateSame = __webpack_require__(7187);
var getWhatWeek = __webpack_require__(4466);
var getYearDay = __webpack_require__(3549);
var getYearWeek = __webpack_require__(9564);
var getMonthWeek = __webpack_require__(995);
var getDayOfYear = __webpack_require__(8873);
var getDayOfMonth = __webpack_require__(3869);
var getDateDiff = __webpack_require__(830);

// 字符串相关的方法
var padEnd = __webpack_require__(3424);
var padStart = __webpack_require__(2819);
var repeat = __webpack_require__(4763);
var trim = __webpack_require__(6965);
var trimRight = __webpack_require__(7546);
var trimLeft = __webpack_require__(5024);
var escape = __webpack_require__(2112);
var unescape = __webpack_require__(2340);
var camelCase = __webpack_require__(2202);
var kebabCase = __webpack_require__(5436);
var startsWith = __webpack_require__(7882);
var endsWith = __webpack_require__(7646);
var template = __webpack_require__(1955);
var toFormatString = __webpack_require__(5844);
var toValueString = __webpack_require__(6220);

// 函数相关的方法
var noop = __webpack_require__(22);
var property = __webpack_require__(7160);
var bind = __webpack_require__(6264);
var once = __webpack_require__(8712);
var after = __webpack_require__(9409);
var before = __webpack_require__(1630);
var throttle = __webpack_require__(207);
var debounce = __webpack_require__(1429);
var delay = __webpack_require__(5011);

// 地址相关的方法
var unserialize = __webpack_require__(2510);
var serialize = __webpack_require__(3345);
var parseUrl = __webpack_require__(7711);

// 浏览器相关的方法
var getBaseURL = __webpack_require__(5554);
var locat = __webpack_require__(8441);
var cookie = __webpack_require__(2289);
var browse = __webpack_require__(1682);
assign(XEUtils, {
  // object
  assign: assign,
  objectEach: objectEach,
  lastObjectEach: lastObjectEach,
  objectMap: objectMap,
  merge: merge,
  // array
  uniq: uniq,
  union: union,
  sortBy: sortBy,
  orderBy: orderBy,
  shuffle: shuffle,
  sample: sample,
  some: some,
  every: every,
  slice: slice,
  filter: filter,
  find: find,
  findLast: findLast,
  findKey: findKey,
  includes: includes,
  arrayIndexOf: arrayIndexOf,
  arrayLastIndexOf: arrayLastIndexOf,
  map: map,
  reduce: reduce,
  copyWithin: copyWithin,
  chunk: chunk,
  zip: zip,
  unzip: unzip,
  zipObject: zipObject,
  flatten: flatten,
  toArray: toArray,
  includeArrays: includeArrays,
  pluck: pluck,
  invoke: invoke,
  arrayEach: arrayEach,
  lastArrayEach: lastArrayEach,
  toArrayTree: toArrayTree,
  toTreeArray: toTreeArray,
  findTree: findTree,
  eachTree: eachTree,
  mapTree: mapTree,
  filterTree: filterTree,
  searchTree: searchTree,
  // base
  hasOwnProp: hasOwnProp,
  eqNull: eqNull,
  isNaN: isNumberNaN,
  isFinite: isNumberFinite,
  isUndefined: isUndefined,
  isArray: isArray,
  isFloat: isFloat,
  isInteger: isInteger,
  isFunction: isFunction,
  isBoolean: isBoolean,
  isString: isString,
  isNumber: isNumber,
  isRegExp: isRegExp,
  isObject: isObject,
  isPlainObject: isPlainObject,
  isDate: isDate,
  isError: isError,
  isTypeError: isTypeError,
  isEmpty: isEmpty,
  isNull: isNull,
  isSymbol: isSymbol,
  isArguments: isArguments,
  isElement: isElement,
  isDocument: isDocument,
  isWindow: isWindow,
  isFormData: isFormData,
  isMap: isMap,
  isWeakMap: isWeakMap,
  isSet: isSet,
  isWeakSet: isWeakSet,
  isLeapYear: isLeapYear,
  isMatch: isMatch,
  isEqual: isEqual,
  isEqualWith: isEqualWith,
  getType: getType,
  uniqueId: uniqueId,
  getSize: getSize,
  indexOf: indexOf,
  lastIndexOf: lastIndexOf,
  findIndexOf: findIndexOf,
  findLastIndexOf: findLastIndexOf,
  toStringJSON: toStringJSON,
  toJSONString: toJSONString,
  keys: keys,
  values: values,
  entries: entries,
  pick: pick,
  omit: omit,
  first: first,
  last: last,
  each: each,
  forOf: forOf,
  lastForOf: lastForOf,
  lastEach: lastEach,
  has: has,
  get: get,
  set: set,
  groupBy: groupBy,
  countBy: countBy,
  clone: clone,
  clear: clear,
  remove: remove,
  range: range,
  destructuring: destructuring,
  // number
  random: random,
  min: min,
  max: max,
  commafy: commafy,
  round: round,
  ceil: ceil,
  floor: floor,
  toFixed: toFixed,
  toNumber: toNumber,
  toNumberString: toNumberString,
  toInteger: toInteger,
  add: add,
  subtract: subtract,
  multiply: multiply,
  divide: divide,
  sum: sum,
  mean: mean,
  // date
  now: now,
  timestamp: timestamp,
  isValidDate: isValidDate,
  isDateSame: isDateSame,
  toStringDate: toStringDate,
  toDateString: toDateString,
  getWhatYear: getWhatYear,
  getWhatQuarter: getWhatQuarter,
  getWhatMonth: getWhatMonth,
  getWhatWeek: getWhatWeek,
  getWhatDay: getWhatDay,
  getYearDay: getYearDay,
  getYearWeek: getYearWeek,
  getMonthWeek: getMonthWeek,
  getDayOfYear: getDayOfYear,
  getDayOfMonth: getDayOfMonth,
  getDateDiff: getDateDiff,
  // string
  trim: trim,
  trimLeft: trimLeft,
  trimRight: trimRight,
  escape: escape,
  unescape: unescape,
  camelCase: camelCase,
  kebabCase: kebabCase,
  repeat: repeat,
  padStart: padStart,
  padEnd: padEnd,
  startsWith: startsWith,
  endsWith: endsWith,
  template: template,
  toFormatString: toFormatString,
  toString: toValueString,
  toValueString: toValueString,
  // function
  noop: noop,
  property: property,
  bind: bind,
  once: once,
  after: after,
  before: before,
  throttle: throttle,
  debounce: debounce,
  delay: delay,
  // url
  unserialize: unserialize,
  serialize: serialize,
  parseUrl: parseUrl,
  // web
  getBaseURL: getBaseURL,
  locat: locat,
  browse: browse,
  cookie: cookie
});
module.exports = XEUtils;

/***/ }),

/***/ 9444:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateIndexOf = __webpack_require__(6803);
var arrayIndexOf = __webpack_require__(592);

/**
  * 返回对象第一个索引值
  *
  * @param {Object} obj 对象
  * @param {Object} val 值
  * @return {Number}
  */
var indexOf = helperCreateIndexOf('indexOf', arrayIndexOf);
module.exports = indexOf;

/***/ }),

/***/ 8519:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var map = __webpack_require__(9660);
var isArray = __webpack_require__(1297);
function deepGetObj(obj, path) {
  var index = 0;
  var len = path.length;
  while (obj && index < len) {
    obj = obj[path[index++]];
  }
  return len && obj ? obj : 0;
}

/**
 * 在list的每个元素上执行方法,任何传递的额外参数都会在调用方法的时候传递给它
 *
 * @param {Array} list
 * @param {Array/String/Function} path
 * @param {...Object} arguments
 * @return {Array}
 */
function invoke(list, path) {
  var func;
  var args = arguments;
  var params = [];
  var paths = [];
  var index = 2;
  var len = args.length;
  for (; index < len; index++) {
    params.push(args[index]);
  }
  if (isArray(path)) {
    len = path.length - 1;
    for (index = 0; index < len; index++) {
      paths.push(path[index]);
    }
    path = path[len];
  }
  return map(list, function (context) {
    if (paths.length) {
      context = deepGetObj(context, paths);
    }
    func = context[path] || path;
    if (func && func.apply) {
      return func.apply(context, params);
    }
  });
}
module.exports = invoke;

/***/ }),

/***/ 9175:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateInInObjectString = __webpack_require__(6438);

/**
  * 判断是否Arguments对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isArguments = helperCreateInInObjectString('Arguments');
module.exports = isArguments;

/***/ }),

/***/ 1297:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateInInObjectString = __webpack_require__(6438);

/**
  * 判断是否数组
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isArray = Array.isArray || helperCreateInInObjectString('Array');
module.exports = isArray;

/***/ }),

/***/ 9439:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateInTypeof = __webpack_require__(1198);

/**
  * 判断是否Boolean对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isBoolean = helperCreateInTypeof('boolean');
module.exports = isBoolean;

/***/ }),

/***/ 6602:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateInInObjectString = __webpack_require__(6438);

/**
  * 判断是否Date对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isDate = helperCreateInInObjectString('Date');
module.exports = isDate;

/***/ }),

/***/ 7187:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var toDateString = __webpack_require__(7670);

/**
 * 比较两个日期
 *
 * @param {Number/String/Date} date1 日期
 * @param {Number/String/Date} date2 日期
 * @param {String} format 对比格式
 */
function isDateSame(date1, date2, format) {
  if (date1 && date2) {
    date1 = toDateString(date1, format);
    return date1 !== 'Invalid Date' && date1 === toDateString(date2, format);
  }
  return false;
}
module.exports = isDateSame;

/***/ }),

/***/ 8791:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticDocument = __webpack_require__(6515);

/**
  * 判断是否Document对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
function isDocument(obj) {
  return !!(obj && staticDocument && obj.nodeType === 9);
}
module.exports = isDocument;

/***/ }),

/***/ 8433:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isString = __webpack_require__(3535);
var isNumber = __webpack_require__(504);

/**
  * 判断是否Element对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
function isElement(obj) {
  return !!(obj && isString(obj.nodeName) && isNumber(obj.nodeType));
}
module.exports = isElement;

/***/ }),

/***/ 7141:
/***/ ((module) => {

/**
  * 判断是否为空对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
function isEmpty(obj) {
  for (var key in obj) {
    return false;
  }
  return true;
}
module.exports = isEmpty;

/***/ }),

/***/ 3145:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperEqualCompare = __webpack_require__(8407);
var helperDefaultCompare = __webpack_require__(549);

/**
 * 深度比较两个对象之间的值是否相等
 *
 * @param {Object} obj1 值1
 * @param {Object} obj2 值2
 * @return {Boolean}
 */
function isEqual(obj1, obj2) {
  return helperEqualCompare(obj1, obj2, helperDefaultCompare);
}
module.exports = isEqual;

/***/ }),

/***/ 3559:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperEqualCompare = __webpack_require__(8407);
var helperDefaultCompare = __webpack_require__(549);
var isFunction = __webpack_require__(7379);
var isUndefined = __webpack_require__(9139);

/**
 * 深度比较两个对象之间的值是否相等，使用自定义比较函数
 *
 * @param {Object} obj1 值1
 * @param {Object} obj2 值2
 * @param {Function} func 自定义函数
 * @return {Boolean}
 */
function isEqualWith(obj1, obj2, func) {
  if (isFunction(func)) {
    return helperEqualCompare(obj1, obj2, function (v1, v2, key, obj1, obj2) {
      var result = func(v1, v2, key, obj1, obj2);
      return isUndefined(result) ? helperDefaultCompare(v1, v2) : !!result;
    }, func);
  }
  return helperEqualCompare(obj1, obj2, helperDefaultCompare);
}
module.exports = isEqualWith;

/***/ }),

/***/ 1875:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateInInObjectString = __webpack_require__(6438);

/**
  * 判断是否Error对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isError = helperCreateInInObjectString('Error');
module.exports = isError;

/***/ }),

/***/ 3707:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isNumber = __webpack_require__(504);
function isNumberFinite(obj) {
  return isNumber(obj) && isFinite(obj);
}
module.exports = isNumberFinite;

/***/ }),

/***/ 9591:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isArray = __webpack_require__(1297);
var isInteger = __webpack_require__(9424);
var isNull = __webpack_require__(7001);

/**
  * 判断是否小数
  *
  * @param {Number} obj 数值
  * @return {Boolean}
  */
function isFloat(obj) {
  return !isNull(obj) && !isNaN(obj) && !isArray(obj) && !isInteger(obj);
}
module.exports = isFloat;

/***/ }),

/***/ 7998:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/* eslint-disable valid-typeof */
var staticStrUndefined = __webpack_require__(4194);

/**
  * 判断是否FormData对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var supportFormData = typeof FormData !== staticStrUndefined;
function isFormData(obj) {
  return supportFormData && obj instanceof FormData;
}
module.exports = isFormData;

/***/ }),

/***/ 7379:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateInTypeof = __webpack_require__(1198);

/**
  * 判断是否方法
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isFunction = helperCreateInTypeof('function');
module.exports = isFunction;

/***/ }),

/***/ 9424:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isArray = __webpack_require__(1297);
var isNull = __webpack_require__(7001);

/**
  * 判断是否整数
  *
  * @param {Number, String} number 数值
  * @return {Boolean}
  */
var isInteger = function (obj) {
  return !isNull(obj) && !isNaN(obj) && !isArray(obj) && obj % 1 === 0;
};
module.exports = isInteger;

/***/ }),

/***/ 6191:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isDate = __webpack_require__(6602);
var toStringDate = __webpack_require__(2214);
var helperNewDate = __webpack_require__(2763);

/**
  * 判断是否闰年
  *
  * @param {Date} date 日期或数字
  * @return {Boolean}
  */
function isLeapYear(date) {
  var year;
  var currentDate = date ? toStringDate(date) : helperNewDate();
  if (isDate(currentDate)) {
    year = currentDate.getFullYear();
    return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
  }
  return false;
}
module.exports = isLeapYear;

/***/ }),

/***/ 7238:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/* eslint-disable valid-typeof */
var staticStrUndefined = __webpack_require__(4194);

/**
  * 判断是否Map对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
 */
var supportMap = typeof Map !== staticStrUndefined;
function isMap(obj) {
  return supportMap && obj instanceof Map;
}
module.exports = isMap;

/***/ }),

/***/ 6238:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var keys = __webpack_require__(1762);
var findIndexOf = __webpack_require__(6655);
var isEqual = __webpack_require__(3145);
var some = __webpack_require__(8815);
var includeArrays = __webpack_require__(4862);

/**
 * 判断属性中的键和值是否包含在对象中
 *
 * @param {Object/Array} obj 对象
 * @param {Object} source 值
 * @return {Boolean}
 */
function isMatch(obj, source) {
  var objKeys = keys(obj);
  var sourceKeys = keys(source);
  if (sourceKeys.length) {
    if (includeArrays(objKeys, sourceKeys)) {
      return some(sourceKeys, function (key2) {
        return findIndexOf(objKeys, function (key1) {
          return key1 === key2 && isEqual(obj[key1], source[key2]);
        }) > -1;
      });
    }
  } else {
    return true;
  }
  return isEqual(obj, source);
}
module.exports = isMatch;

/***/ }),

/***/ 5633:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isNumber = __webpack_require__(504);

/* eslint-disable eqeqeq */
function isNumberNaN(obj) {
  return isNumber(obj) && isNaN(obj);
}
module.exports = isNumberNaN;

/***/ }),

/***/ 7001:
/***/ ((module) => {

/**
  * 判断是否为Null
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
function isNull(obj) {
  return obj === null;
}
module.exports = isNull;

/***/ }),

/***/ 504:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateInTypeof = __webpack_require__(1198);

/**
  * 判断是否Number对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isNumber = helperCreateInTypeof('number');
module.exports = isNumber;

/***/ }),

/***/ 8840:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateInTypeof = __webpack_require__(1198);

/**
  * 判断是否Object对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isObject = helperCreateInTypeof('object');
module.exports = isObject;

/***/ }),

/***/ 7143:
/***/ ((module) => {

/**
  * 判断是否对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
function isPlainObject(obj) {
  return obj ? obj.constructor === Object : false;
}
module.exports = isPlainObject;

/***/ }),

/***/ 7211:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateInInObjectString = __webpack_require__(6438);

/**
  * 判断是否RegExp对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isRegExp = helperCreateInInObjectString('RegExp');
module.exports = isRegExp;

/***/ }),

/***/ 6742:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/* eslint-disable valid-typeof */
var staticStrUndefined = __webpack_require__(4194);

/**
  * 判断是否Set对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
 */
var supportSet = typeof Set !== staticStrUndefined;
function isSet(obj) {
  return supportSet && obj instanceof Set;
}
module.exports = isSet;

/***/ }),

/***/ 3535:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateInTypeof = __webpack_require__(1198);

/**
  * 判断是否String对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isString = helperCreateInTypeof('string');
module.exports = isString;

/***/ }),

/***/ 3387:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/* eslint-disable valid-typeof */
var staticStrUndefined = __webpack_require__(4194);

/**
  * 判断是否Symbol对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var supportSymbol = typeof Symbol !== staticStrUndefined;
function isSymbol(obj) {
  return supportSymbol && Symbol.isSymbol ? Symbol.isSymbol(obj) : typeof obj === 'symbol';
}
module.exports = isSymbol;

/***/ }),

/***/ 186:
/***/ ((module) => {

/**
  * 判断是否TypeError对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
function isTypeError(obj) {
  return obj ? obj.constructor === TypeError : false;
}
module.exports = isTypeError;

/***/ }),

/***/ 9139:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticStrUndefined = __webpack_require__(4194);
var helperCreateInTypeof = __webpack_require__(1198);

/**
  * 判断是否Undefined
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isUndefined = helperCreateInTypeof(staticStrUndefined);
module.exports = isUndefined;

/***/ }),

/***/ 8740:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isDate = __webpack_require__(6602);
var helperGetDateTime = __webpack_require__(4404);

/**
  * 判断是否有效的Date对象
  *
  * @param {any} val 对象
  * @return {boolean}
  */
function isValidDate(val) {
  return isDate(val) && !isNaN(helperGetDateTime(val));
}
module.exports = isValidDate;

/***/ }),

/***/ 3026:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/* eslint-disable valid-typeof */
var staticStrUndefined = __webpack_require__(4194);

/**
  * 判断是否WeakMap对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
 */
var supportWeakMap = typeof WeakMap !== staticStrUndefined;
function isWeakMap(obj) {
  return supportWeakMap && obj instanceof WeakMap;
}
module.exports = isWeakMap;

/***/ }),

/***/ 8200:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/* eslint-disable valid-typeof */
var staticStrUndefined = __webpack_require__(4194);

/**
  * 判断是否WeakSet对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
 */
var supportWeakSet = typeof WeakSet !== staticStrUndefined;
function isWeakSet(obj) {
  return supportWeakSet && obj instanceof WeakSet;
}
module.exports = isWeakSet;

/***/ }),

/***/ 3427:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticWindow = __webpack_require__(7743);

/**
  * 判断是否Window对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
function isWindow(obj) {
  return !!(staticWindow && !!(obj && obj === obj.window));
}
module.exports = isWindow;

/***/ }),

/***/ 5436:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var toValueString = __webpack_require__(6220);
var helperStringSubstring = __webpack_require__(8461);
var helperStringLowerCase = __webpack_require__(4039);
var kebabCacheMaps = {};

/**
  * 将带驼峰字符串转成字符串,例如： projectName 转为 project-name
  *
  * @param {String} str 字符串
  * @return {String}
  */
function kebabCase(str) {
  str = toValueString(str);
  if (kebabCacheMaps[str]) {
    return kebabCacheMaps[str];
  }
  if (/^[A-Z]+$/.test(str)) {
    return helperStringLowerCase(str);
  }
  var rest = str.replace(/^([a-z])([A-Z]+)([a-z]+)$/, function (text, prevLower, upper, nextLower) {
    var upperLen = upper.length;
    if (upperLen > 1) {
      return prevLower + '-' + helperStringLowerCase(helperStringSubstring(upper, 0, upperLen - 1)) + '-' + helperStringLowerCase(helperStringSubstring(upper, upperLen - 1, upperLen)) + nextLower;
    }
    return helperStringLowerCase(prevLower + '-' + upper + nextLower);
  }).replace(/^([A-Z]+)([a-z]+)?$/, function (text, upper, nextLower) {
    var upperLen = upper.length;
    return helperStringLowerCase(helperStringSubstring(upper, 0, upperLen - 1) + '-' + helperStringSubstring(upper, upperLen - 1, upperLen) + (nextLower || ''));
  }).replace(/([a-z]?)([A-Z]+)([a-z]?)/g, function (text, prevLower, upper, nextLower, index) {
    var upperLen = upper.length;
    if (upperLen > 1) {
      if (prevLower) {
        prevLower += '-';
      }
      if (nextLower) {
        return (prevLower || '') + helperStringLowerCase(helperStringSubstring(upper, 0, upperLen - 1)) + '-' + helperStringLowerCase(helperStringSubstring(upper, upperLen - 1, upperLen)) + nextLower;
      }
    }
    return (prevLower || '') + (index ? '-' : '') + helperStringLowerCase(upper) + (nextLower || '');
  });
  rest = rest.replace(/([-]+)/g, function (text, flag, index) {
    return index && index + flag.length < rest.length ? '-' : '';
  });
  kebabCacheMaps[str] = rest;
  return rest;
}
module.exports = kebabCase;

/***/ }),

/***/ 1762:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateGetObjects = __webpack_require__(1137);

/**
  * 获取对象所有属性
  *
  * @param {Object} obj 对象/数组
  * @return {Array}
  */
var keys = helperCreateGetObjects('keys', 1);
module.exports = keys;

/***/ }),

/***/ 1661:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var values = __webpack_require__(3656);

/**
  * 获取对象最后一个值
  *
  * @param {Object} obj 对象/数组
  * @return {Object}
  */
function last(obj) {
  var list = values(obj);
  return list[list.length - 1];
}
module.exports = last;

/***/ }),

/***/ 8854:
/***/ ((module) => {

function lastArrayEach(obj, iterate, context) {
  for (var len = obj.length - 1; len >= 0; len--) {
    iterate.call(context, obj[len], len, obj);
  }
}
module.exports = lastArrayEach;

/***/ }),

/***/ 1636:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isArray = __webpack_require__(1297);
var lastArrayEach = __webpack_require__(8854);
var lastObjectEach = __webpack_require__(7197);

/**
  * 迭代器,从最后开始迭代
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
function lastEach(obj, iterate, context) {
  if (obj) {
    return (isArray(obj) ? lastArrayEach : lastObjectEach)(obj, iterate, context);
  }
  return obj;
}
module.exports = lastEach;

/***/ }),

/***/ 3244:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isArray = __webpack_require__(1297);
var keys = __webpack_require__(1692);

/**
  * 已废弃
  * @deprecated
  */
function lastForOf(obj, iterate, context) {
  if (obj) {
    var len, list;
    if (isArray(obj)) {
      for (len = obj.length - 1; len >= 0; len--) {
        if (iterate.call(context, obj[len], len, obj) === false) {
          break;
        }
      }
    } else {
      list = keys(obj);
      for (len = list.length - 1; len >= 0; len--) {
        if (iterate.call(context, obj[list[len]], list[len], obj) === false) {
          break;
        }
      }
    }
  }
}
module.exports = lastForOf;

/***/ }),

/***/ 9262:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateIndexOf = __webpack_require__(6803);
var arrayLastIndexOf = __webpack_require__(3920);

/**
  * 从最后开始的索引值,返回对象第一个索引值
  *
  * @param {Object} array 对象
  * @param {Object} val 值
  * @return {Number}
  */
var lastIndexOf = helperCreateIndexOf('lastIndexOf', arrayLastIndexOf);
module.exports = lastIndexOf;

/***/ }),

/***/ 7197:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var lastArrayEach = __webpack_require__(8854);
var keys = __webpack_require__(1762);
function lastObjectEach(obj, iterate, context) {
  lastArrayEach(keys(obj), function (key) {
    iterate.call(context, obj[key], key, obj);
  });
}
module.exports = lastObjectEach;

/***/ }),

/***/ 8441:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticLocation = __webpack_require__(7522);
var parseUrl = __webpack_require__(7711);

/**
  * 获取地址栏信息
  *
  * @return Object
  */
function locat() {
  return staticLocation ? parseUrl(staticLocation.href) : {};
}
module.exports = locat;

/***/ }),

/***/ 9660:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var each = __webpack_require__(5360);

/**
  * 指定方法后的返回值组成的新数组
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Array}
  */
function map(obj, iterate, context) {
  var result = [];
  if (obj && arguments.length > 1) {
    if (obj.map) {
      return obj.map(iterate, context);
    } else {
      each(obj, function () {
        result.push(iterate.apply(context, arguments));
      });
    }
  }
  return result;
}
module.exports = map;

/***/ }),

/***/ 194:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateTreeFunc = __webpack_require__(5366);
var map = __webpack_require__(9660);
function mapTreeItem(parent, obj, iterate, context, path, node, parseChildren, opts) {
  var paths, nodes, rest;
  var mapChildren = opts.mapChildren || parseChildren;
  return map(obj, function (item, index) {
    paths = path.concat(['' + index]);
    nodes = node.concat([item]);
    rest = iterate.call(context, item, index, obj, paths, parent, nodes);
    if (rest && item && parseChildren && item[parseChildren]) {
      rest[mapChildren] = mapTreeItem(item, item[parseChildren], iterate, context, paths, nodes, parseChildren, opts);
    }
    return rest;
  });
}

/**
  * 从树结构中指定方法后的返回值组成的新数组
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, items, path, parent, nodes) 回调
  * @param {Object} options {children: 'children'}
  * @param {Object} context 上下文
  * @return {Object/Array}
  */
var mapTree = helperCreateTreeFunc(mapTreeItem);
module.exports = mapTree;

/***/ }),

/***/ 4475:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateMinMax = __webpack_require__(9434);

/**
  * 获取最大值
  *
  * @param {Array} arr 数组
  * @param {Function} iterate(item, index, obj) 回调
  * @return {Number}
  */
var max = helperCreateMinMax(function (rest, itemVal) {
  return rest < itemVal;
});
module.exports = max;

/***/ }),

/***/ 1790:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperNumberDivide = __webpack_require__(436);
var getSize = __webpack_require__(1776);
var sum = __webpack_require__(5515);

/**
  * 求平均值函数
  *
  * @param {Array} array 数组
  * @param {Function/String} iterate 方法或属性
  * @param {Object} context 上下文
  * @return {Number}
  */
function mean(array, iterate, context) {
  return helperNumberDivide(sum(array, iterate, context), getSize(array));
}
module.exports = mean;

/***/ }),

/***/ 2950:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isArray = __webpack_require__(1297);
var isPlainObject = __webpack_require__(7143);
var each = __webpack_require__(5360);
function handleMerge(target, source) {
  if (isPlainObject(target) && isPlainObject(source) || isArray(target) && isArray(source)) {
    each(source, function (obj, key) {
      target[key] = handleMerge(target[key], obj);
    });
    return target;
  }
  return source;
}

/**
  * 将一个或多个源对象合并到目标对象中
  *
  * @param {Object} target 目标对象
  * @param {...Object}
  * @return {Boolean}
  */
var merge = function (target) {
  if (!target) {
    target = {};
  }
  var args = arguments;
  var len = args.length;
  for (var source, index = 1; index < len; index++) {
    source = args[index];
    if (source) {
      handleMerge(target, source);
    }
  }
  return target;
};
module.exports = merge;

/***/ }),

/***/ 1024:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateMinMax = __webpack_require__(9434);

/**
  * 获取最小值
  *
  * @param {Array} arr 数组
  * @param {Function} iterate(item, index, obj) 回调
  * @return {Number}
  */
var min = helperCreateMinMax(function (rest, itemVal) {
  return rest > itemVal;
});
module.exports = min;

/***/ }),

/***/ 939:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperMultiply = __webpack_require__(4968);
var toNumber = __webpack_require__(2661);

/**
 * 乘法运算
 *
 * @param { Number } num1 数值1
 * @param { Number } num2 数值2
 * @return {Number}
 */
function multiply(num1, num2) {
  var multiplier = toNumber(num1);
  var multiplicand = toNumber(num2);
  return helperMultiply(multiplier, multiplicand);
}
module.exports = multiply;

/***/ }),

/***/ 22:
/***/ ((module) => {

/**
 * 一个空的方法，始终返回 undefined，可用于初始化值
 */
function noop() {}
module.exports = noop;

/***/ }),

/***/ 3050:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperGetDateTime = __webpack_require__(4404);
var helperNewDate = __webpack_require__(2763);

/**
 * 返回当前时间戳
 *
 * @returns Number
 */
var now = Date.now || function () {
  return helperGetDateTime(helperNewDate());
};
module.exports = now;

/***/ }),

/***/ 8480:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var hasOwnProp = __webpack_require__(1692);
function objectEach(obj, iterate, context) {
  if (obj) {
    for (var key in obj) {
      if (hasOwnProp(obj, key)) {
        iterate.call(context, obj[key], key, obj);
      }
    }
  }
}
module.exports = objectEach;

/***/ }),

/***/ 8333:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var each = __webpack_require__(5360);
var isFunction = __webpack_require__(7379);
var property = __webpack_require__(7160);

/**
  * 指定方法后的返回值组成的新对象
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
function objectMap(obj, iterate, context) {
  var result = {};
  if (obj) {
    if (iterate) {
      if (!isFunction(iterate)) {
        iterate = property(iterate);
      }
      each(obj, function (val, index) {
        result[index] = iterate.call(context, val, index, obj);
      });
    } else {
      return obj;
    }
  }
  return result;
}
module.exports = objectMap;

/***/ }),

/***/ 3168:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreatePickOmit = __webpack_require__(526);

/**
 * 根据 key 排除指定的属性值，返回一个新的对象
 *
 * @param {Object} obj 对象
 * @param {String/Array} key 键数组
 * @return {Object}
 */
var omit = helperCreatePickOmit(0, 1);
module.exports = omit;

/***/ }),

/***/ 8712:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var slice = __webpack_require__(2616);

/**
  * 创建一个只能调用一次的函数,只会返回第一次执行后的结果
  *
  * @param {Function} callback 函数
  * @param {Object} context 上下文
  * @param {*} args 额外的参数
  * @return {Object}
  */
function once(callback, context) {
  var done = false;
  var rest = null;
  var args = slice(arguments, 2);
  return function () {
    if (done) {
      return rest;
    }
    rest = callback.apply(context, slice(arguments).concat(args));
    done = true;
    return rest;
  };
}
module.exports = once;

/***/ }),

/***/ 9891:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var arrayEach = __webpack_require__(1418);
var toArray = __webpack_require__(423);
var map = __webpack_require__(9660);
var isArray = __webpack_require__(1297);
var isFunction = __webpack_require__(7379);
var isPlainObject = __webpack_require__(7143);
var isUndefined = __webpack_require__(9139);
var isNull = __webpack_require__(7001);
var eqNull = __webpack_require__(8878);
var get = __webpack_require__(4192);
var property = __webpack_require__(7160);
var ORDER_PROP_ASC = 'asc';
var ORDER_PROP_DESC = 'desc';

// function handleSort (v1, v2) {
//   return v1 > v2 ? 1 : -1
// }

// '' < 数字 < 字符 < null < undefined
function handleSort(v1, v2) {
  if (isUndefined(v1)) {
    return 1;
  }
  if (isNull(v1)) {
    return isUndefined(v2) ? -1 : 1;
  }
  return v1 && v1.localeCompare ? v1.localeCompare(v2) : v1 > v2 ? 1 : -1;
}
function buildMultiOrders(name, confs, compares) {
  return function (item1, item2) {
    var v1 = item1[name];
    var v2 = item2[name];
    if (v1 === v2) {
      return compares ? compares(item1, item2) : 0;
    }
    return confs.order === ORDER_PROP_DESC ? handleSort(v2, v1) : handleSort(v1, v2);
  };
}
function getSortConfs(arr, list, fieldConfs, context) {
  var sortConfs = [];
  fieldConfs = isArray(fieldConfs) ? fieldConfs : [fieldConfs];
  arrayEach(fieldConfs, function (handle, index) {
    if (handle) {
      var field = handle;
      var order;
      if (isArray(handle)) {
        field = handle[0];
        order = handle[1];
      } else if (isPlainObject(handle)) {
        field = handle.field;
        order = handle.order;
      }
      sortConfs.push({
        field: field,
        order: order || ORDER_PROP_ASC
      });
      arrayEach(list, isFunction(field) ? function (item, key) {
        item[index] = field.call(context, item.data, key, arr);
      } : function (item) {
        item[index] = field ? get(item.data, field) : item.data;
      });
    }
  });
  return sortConfs;
}

/**
  * 将数组进行排序
  *
  * @param {Array} arr 数组
  * @param {Function/String/Array} fieldConfs 方法或属性
  * @param {Object} context 上下文
  * @return {Array}
  */
function orderBy(arr, fieldConfs, context) {
  if (arr) {
    if (eqNull(fieldConfs)) {
      return toArray(arr).sort(handleSort);
    }
    var compares;
    var list = map(arr, function (item) {
      return {
        data: item
      };
    });
    var sortConfs = getSortConfs(arr, list, fieldConfs, context);
    var len = sortConfs.length - 1;
    while (len >= 0) {
      compares = buildMultiOrders(len, sortConfs[len], compares);
      len--;
    }
    if (compares) {
      list = list.sort(compares);
    }
    return map(list, property('data'));
  }
  return [];
}
module.exports = orderBy;

/***/ }),

/***/ 3424:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var toValueString = __webpack_require__(6220);
var isUndefined = __webpack_require__(9139);
var helperStringRepeat = __webpack_require__(7388);

/**
  * 用指定字符从后面开始补全字符串
  *
  * @param {String} str 字符串
  * @param {Number} targetLength 结果长度
  * @param {Number} padString 补全字符
  * @return {String}
  */
function padEnd(str, targetLength, padString) {
  var rest = toValueString(str);
  targetLength = targetLength >> 0;
  padString = isUndefined(padString) ? ' ' : '' + padString;
  if (rest.padEnd) {
    return rest.padEnd(targetLength, padString);
  }
  if (targetLength > rest.length) {
    targetLength -= rest.length;
    if (targetLength > padString.length) {
      padString += helperStringRepeat(padString, targetLength / padString.length);
    }
    return rest + padString.slice(0, targetLength);
  }
  return rest;
}
module.exports = padEnd;

/***/ }),

/***/ 2819:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var toValueString = __webpack_require__(6220);
var isUndefined = __webpack_require__(9139);
var helperStringRepeat = __webpack_require__(7388);

/**
  * 用指定字符从前面开始补全字符串
  *
  * @param {String} str 字符串
  * @param {Number} targetLength 结果长度
  * @param {Number} padString 补全字符
  * @return {String}
  */
function padStart(str, targetLength, padString) {
  var rest = toValueString(str);
  targetLength = targetLength >> 0;
  padString = isUndefined(padString) ? ' ' : '' + padString;
  if (rest.padStart) {
    return rest.padStart(targetLength, padString);
  }
  if (targetLength > rest.length) {
    targetLength -= rest.length;
    if (targetLength > padString.length) {
      padString += helperStringRepeat(padString, targetLength / padString.length);
    }
    return padString.slice(0, targetLength) + rest;
  }
  return rest;
}
module.exports = padStart;

/***/ }),

/***/ 7711:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticLocation = __webpack_require__(7522);
var unserialize = __webpack_require__(2510);
var helperGetLocatOrigin = __webpack_require__(9151);
function parseURLQuery(uri) {
  return unserialize(uri.split('?')[1] || '');
}
function parseUrl(url) {
  var hashs, portText, searchs, parsed;
  var href = '' + url;
  if (href.indexOf('//') === 0) {
    href = (staticLocation ? staticLocation.protocol : '') + href;
  } else if (href.indexOf('/') === 0) {
    href = helperGetLocatOrigin() + href;
  }
  searchs = href.replace(/#.*/, '').match(/(\?.*)/);
  parsed = {
    href: href,
    hash: '',
    host: '',
    hostname: '',
    protocol: '',
    port: '',
    search: searchs && searchs[1] && searchs[1].length > 1 ? searchs[1] : ''
  };
  parsed.path = href.replace(/^([a-z0-9.+-]*:)\/\//, function (text, protocol) {
    parsed.protocol = protocol;
    return '';
  }).replace(/^([a-z0-9.+-]*)(:\d+)?\/?/, function (text, hostname, port) {
    portText = port || '';
    parsed.port = portText.replace(':', '');
    parsed.hostname = hostname;
    parsed.host = hostname + portText;
    return '/';
  }).replace(/(#.*)/, function (text, hash) {
    parsed.hash = hash.length > 1 ? hash : '';
    return '';
  });
  hashs = parsed.hash.match(/#((.*)\?|(.*))/);
  parsed.pathname = parsed.path.replace(/(\?|#.*).*/, '');
  parsed.origin = parsed.protocol + '//' + parsed.host;
  parsed.hashKey = hashs ? hashs[2] || hashs[1] || '' : '';
  parsed.hashQuery = parseURLQuery(parsed.hash);
  parsed.searchQuery = parseURLQuery(parsed.search);
  return parsed;
}
module.exports = parseUrl;

/***/ }),

/***/ 2334:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreatePickOmit = __webpack_require__(526);

/**
 * 根据 key 过滤指定的属性值，返回一个新的对象
 *
 * @param {Object} obj 对象
 * @param {String/Array} key 键数组
 * @return {Object}
 */
var pick = helperCreatePickOmit(1, 0);
module.exports = pick;

/***/ }),

/***/ 624:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var map = __webpack_require__(9660);
var property = __webpack_require__(7160);

/**
  * 获取数组对象中某属性值，返回一个数组
  *
  * @param {Array} array 数组
  * @param {String} key 属性值
  * @return {Array}
  */
function pluck(obj, key) {
  return map(obj, property(key));
}
module.exports = pluck;

/***/ }),

/***/ 7160:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isNull = __webpack_require__(7001);

/**
 * 返回一个获取对象属性的函数
 *
 * @param {String} name 属性名
 * @param {Object} defs 空值
 */
function property(name, defs) {
  return function (obj) {
    return isNull(obj) ? defs : obj[name];
  };
}
module.exports = property;

/***/ }),

/***/ 3106:
/***/ ((module) => {

/**
  * 获取一个指定范围内随机数
  *
  * @param {Number} minVal 最小值
  * @param {Number} maxVal 最大值
  * @return {Number}
  */
function random(minVal, maxVal) {
  return minVal >= maxVal ? minVal : (minVal = minVal >> 0) + Math.round(Math.random() * ((maxVal || 9) - minVal));
}
module.exports = random;

/***/ }),

/***/ 1461:
/***/ ((module) => {

/**
  * 序号列表生成函数
  *
  * @param {Number} start 起始值
  * @param {Number} stop 结束值
  * @param {Number} step 自增值
  * @return {Array}
  */
function range(start, stop, step) {
  var index, len;
  var result = [];
  var args = arguments;
  if (args.length < 2) {
    stop = args[0];
    start = 0;
  }
  index = start >> 0;
  len = stop >> 0;
  if (index < stop) {
    step = step >> 0 || 1;
    for (; index < len; index += step) {
      result.push(index);
    }
  }
  return result;
}
module.exports = range;

/***/ }),

/***/ 3743:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var keys = __webpack_require__(1762);

/**
  * 接收一个函数作为累加器，数组中的每个值（从左到右）开始合并，最终为一个值。
  *
  * @param {Array} array 数组
  * @param {Function} callback 方法
  * @param {Object} initialValue 初始值
  * @return {Number}
  */
function reduce(array, callback, initialValue) {
  if (array) {
    var len, reduceMethod;
    var index = 0;
    var context = null;
    var previous = initialValue;
    var isInitialVal = arguments.length > 2;
    var keyList = keys(array);
    if (array.length && array.reduce) {
      reduceMethod = function () {
        return callback.apply(context, arguments);
      };
      if (isInitialVal) {
        return array.reduce(reduceMethod, previous);
      }
      return array.reduce(reduceMethod);
    }
    if (isInitialVal) {
      index = 1;
      previous = array[keyList[0]];
    }
    for (len = keyList.length; index < len; index++) {
      previous = callback.call(context, previous, array[keyList[index]], index, array);
    }
    return previous;
  }
}
module.exports = reduce;

/***/ }),

/***/ 4520:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperDeleteProperty = __webpack_require__(7203);
var isFunction = __webpack_require__(7379);
var isArray = __webpack_require__(1297);
var each = __webpack_require__(5360);
var arrayEach = __webpack_require__(1418);
var lastEach = __webpack_require__(1636);
var clear = __webpack_require__(2095);
var eqNull = __webpack_require__(8878);
function pluckProperty(name) {
  return function (obj, key) {
    return key === name;
  };
}

/**
  * 移除对象属性
  *
  * @param {Object/Array} obj 对象/数组
  * @param {Function/String} iterate 方法或属性
  * @param {Object} context 上下文
  * @return {Object/Array}
  */
function remove(obj, iterate, context) {
  if (obj) {
    if (!eqNull(iterate)) {
      var removeKeys = [];
      var rest = [];
      if (!isFunction(iterate)) {
        iterate = pluckProperty(iterate);
      }
      each(obj, function (item, index, rest) {
        if (iterate.call(context, item, index, rest)) {
          removeKeys.push(index);
        }
      });
      if (isArray(obj)) {
        lastEach(removeKeys, function (item, key) {
          rest.push(obj[item]);
          obj.splice(item, 1);
        });
      } else {
        rest = {};
        arrayEach(removeKeys, function (key) {
          rest[key] = obj[key];
          helperDeleteProperty(obj, key);
        });
      }
      return rest;
    }
    return clear(obj);
  }
  return obj;
}
module.exports = remove;

/***/ }),

/***/ 4763:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var toValueString = __webpack_require__(6220);
var helperStringRepeat = __webpack_require__(7388);

/**
  * 将字符串重复 n 次
  *
  * @param {String} str 字符串
  * @param {Number} count 次数
  * @return {String}
  */
function repeat(str, count) {
  return helperStringRepeat(toValueString(str), count);
}
module.exports = repeat;

/***/ }),

/***/ 3221:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateMathNumber = __webpack_require__(2148);

/**
 * 将数值四舍五入
 *
 * @param {string|number} num 数值
 * @param {number} digits 小数保留位数
 * @return {number}
 */
var round = helperCreateMathNumber('round');
module.exports = round;

/***/ }),

/***/ 5380:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var shuffle = __webpack_require__(7467);

/**
  * 从一个数组中随机返回几个元素
  *
  * @param {Array} array 数组
  * @param {Number} number 个数
  * @return {Array}
  */
function sample(array, number) {
  var result = shuffle(array);
  if (arguments.length <= 1) {
    return result[0];
  }
  if (number < result.length) {
    result.length = number || 0;
  }
  return result;
}
module.exports = sample;

/***/ }),

/***/ 27:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateTreeFunc = __webpack_require__(5366);
var arrayEach = __webpack_require__(1418);
var assign = __webpack_require__(1524);
function searchTreeItem(matchParent, parent, obj, iterate, context, path, node, parseChildren, opts) {
  var paths, nodes, rest, isMatch, hasChild;
  var rests = [];
  var hasOriginal = opts.original;
  var sourceData = opts.data;
  var mapChildren = opts.mapChildren || parseChildren;
  var isEvery = opts.isEvery;
  arrayEach(obj, function (item, index) {
    paths = path.concat(['' + index]);
    nodes = node.concat([item]);
    isMatch = matchParent && !isEvery || iterate.call(context, item, index, obj, paths, parent, nodes);
    hasChild = parseChildren && item[parseChildren];
    if (isMatch || hasChild) {
      if (hasOriginal) {
        rest = item;
      } else {
        rest = assign({}, item);
        if (sourceData) {
          rest[sourceData] = item;
        }
      }
      rest[mapChildren] = searchTreeItem(isMatch, item, item[parseChildren], iterate, context, paths, nodes, parseChildren, opts);
      if (isMatch || rest[mapChildren].length) {
        rests.push(rest);
      }
    } else if (isMatch) {
      rests.push(rest);
    }
  });
  return rests;
}

/**
  * 从树结构中根据回调查找数据
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, items, path, parent, nodes) 回调
  * @param {Object} options {children: 'children'}
  * @param {Object} context 上下文
  * @return {Array}
  */
var searchTree = helperCreateTreeFunc(function (parent, obj, iterate, context, path, nodes, parseChildren, opts) {
  return searchTreeItem(0, parent, obj, iterate, context, path, nodes, parseChildren, opts);
});
module.exports = searchTree;

/***/ }),

/***/ 3345:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticEncodeURIComponent = __webpack_require__(8372);
var each = __webpack_require__(5360);
var isArray = __webpack_require__(1297);
var isNull = __webpack_require__(7001);
var isUndefined = __webpack_require__(9139);
var isPlainObject = __webpack_require__(7143);
function stringifyParams(resultVal, resultKey, isArr) {
  var _arr;
  var result = [];
  each(resultVal, function (item, key) {
    _arr = isArray(item);
    if (isPlainObject(item) || _arr) {
      result = result.concat(stringifyParams(item, resultKey + '[' + key + ']', _arr));
    } else {
      result.push(staticEncodeURIComponent(resultKey + '[' + (isArr ? '' : key) + ']') + '=' + staticEncodeURIComponent(isNull(item) ? '' : item));
    }
  });
  return result;
}

/**
 * 序列化查询参数
 *
 * @param {Object} query 查询参数
 */
function serialize(query) {
  var _arr;
  var params = [];
  each(query, function (item, key) {
    if (!isUndefined(item)) {
      _arr = isArray(item);
      if (isPlainObject(item) || _arr) {
        params = params.concat(stringifyParams(item, key, _arr));
      } else {
        params.push(staticEncodeURIComponent(key) + '=' + staticEncodeURIComponent(isNull(item) ? '' : item));
      }
    }
  });
  return params.join('&').replace(/%20/g, '+');
}
module.exports = serialize;

/***/ }),

/***/ 6069:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticParseInt = __webpack_require__(7524);
var helperGetHGSKeys = __webpack_require__(7374);
var hasOwnProp = __webpack_require__(1692);
var sKeyRE = /(.+)?\[(\d+)\]$/;
function setDeepProps(obj, key, isEnd, nextKey, value) {
  if (obj[key]) {
    if (isEnd) {
      obj[key] = value;
    }
  } else {
    var index;
    var rest;
    var currMatchs = key ? key.match(sKeyRE) : null;
    if (isEnd) {
      rest = value;
    } else {
      var nextMatchs = nextKey ? nextKey.match(sKeyRE) : null;
      if (nextMatchs && !nextMatchs[1]) {
        // 如果下一个属性为数组类型
        rest = new Array(staticParseInt(nextMatchs[2]) + 1);
      } else {
        rest = {};
      }
    }
    if (currMatchs) {
      if (currMatchs[1]) {
        // 如果为对象中数组
        index = staticParseInt(currMatchs[2]);
        if (obj[currMatchs[1]]) {
          if (isEnd) {
            obj[currMatchs[1]][index] = rest;
          } else {
            if (obj[currMatchs[1]][index]) {
              rest = obj[currMatchs[1]][index];
            } else {
              obj[currMatchs[1]][index] = rest;
            }
          }
        } else {
          obj[currMatchs[1]] = new Array(index + 1);
          obj[currMatchs[1]][index] = rest;
        }
      } else {
        // 如果为数组
        obj[currMatchs[2]] = rest;
      }
    } else {
      // 如果为对象
      obj[key] = rest;
    }
    return rest;
  }
  return obj[key];
}

/**
 * 设置对象属性上的值。如果属性不存在则创建它
 * @param {Object/Array} obj 对象
 * @param {String/Function} property 键、路径
 * @param {Object} value 值
 */
function set(obj, property, value) {
  if (obj) {
    if ((obj[property] || hasOwnProp(obj, property)) && !isPrototypePolluted(property)) {
      obj[property] = value;
    } else {
      var rest = obj;
      var props = helperGetHGSKeys(property);
      var len = props.length;
      for (var index = 0; index < len; index++) {
        if (isPrototypePolluted(props[index])) {
          continue;
        }
        var isEnd = index === len - 1;
        rest = setDeepProps(rest, props[index], isEnd, isEnd ? null : props[index + 1], value);
      }
    }
  }
  return obj;
}

/**
 * Blacklist certain keys to prevent Prototype Pollution
 * @param {string} key
 */
function isPrototypePolluted(key) {
  return key === '__proto__' || key === 'constructor' || key === 'prototype';
}
module.exports = set;

/***/ }),

/***/ 1450:
/***/ ((module) => {

"use strict";


var setupDefaults = {
  cookies: {
    path: '/'
  },
  treeOptions: {
    parentKey: 'parentId',
    key: 'id',
    children: 'children'
  },
  parseDateFormat: 'yyyy-MM-dd HH:mm:ss',
  firstDayOfWeek: 1
};
module.exports = setupDefaults;

/***/ }),

/***/ 7467:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var random = __webpack_require__(3106);
var values = __webpack_require__(3656);

/**
  * 将一个数组随机打乱，返回一个新的数组
  *
  * @param {Array} array 数组
  * @return {Array}
  */
function shuffle(array) {
  var index;
  var result = [];
  var list = values(array);
  var len = list.length - 1;
  for (; len >= 0; len--) {
    index = len > 0 ? random(0, len) : 0;
    result.push(list[index]);
    list.splice(index, 1);
  }
  return result;
}
module.exports = shuffle;

/***/ }),

/***/ 2616:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var toNumber = __webpack_require__(2661);

/**
 * 裁剪 Arguments 或数组 array，从 start 位置开始到 end 结束，但不包括 end 本身的位置
 * @param {Array/Arguments} array 数组或Arguments
 * @param {Number} startIndex 开始索引
 * @param {Number} endIndex 结束索引
 */
function slice(array, startIndex, endIndex) {
  var result = [];
  var argsSize = arguments.length;
  if (array) {
    startIndex = argsSize >= 2 ? toNumber(startIndex) : 0;
    endIndex = argsSize >= 3 ? toNumber(endIndex) : array.length;
    if (array.slice) {
      return array.slice(startIndex, endIndex);
    }
    for (; startIndex < endIndex; startIndex++) {
      result.push(array[startIndex]);
    }
  }
  return result;
}
module.exports = slice;

/***/ }),

/***/ 8815:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateIterateHandle = __webpack_require__(7889);

/**
  * 对象中的值中的每一项运行给定函数,如果函数对任一项返回true,则返回true,否则返回false
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Boolean}
  */
var some = helperCreateIterateHandle('some', 1, 0, true, false);
module.exports = some;

/***/ }),

/***/ 1969:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var orderBy = __webpack_require__(9891);
var sortBy = orderBy;
module.exports = sortBy;

/***/ }),

/***/ 7882:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var toValueString = __webpack_require__(6220);

/**
  * 判断字符串是否在源字符串的头部
  *
  * @param {String} str 字符串
  * @param {String/Number} val 值
  * @param {Number} startIndex 开始索引
  * @return {String}
  */
function startsWith(str, val, startIndex) {
  var rest = toValueString(str);
  return (arguments.length === 1 ? rest : rest.substring(startIndex)).indexOf(val) === 0;
}
module.exports = startsWith;

/***/ }),

/***/ 5766:
/***/ ((module) => {

var staticDayTime = 86400000;
module.exports = staticDayTime;

/***/ }),

/***/ 5709:
/***/ ((module) => {

var staticDecodeURIComponent = decodeURIComponent;
module.exports = staticDecodeURIComponent;

/***/ }),

/***/ 6515:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticStrUndefined = __webpack_require__(4194);

/* eslint-disable valid-typeof */
var staticDocument = typeof document === staticStrUndefined ? 0 : document;
module.exports = staticDocument;

/***/ }),

/***/ 8372:
/***/ ((module) => {

var staticEncodeURIComponent = encodeURIComponent;
module.exports = staticEncodeURIComponent;

/***/ }),

/***/ 6083:
/***/ ((module) => {

var staticEscapeMap = {
  '&': '&amp;',
  '<': '&lt;',
  '>': '&gt;',
  '"': '&quot;',
  "'": '&#x27;',
  '`': '&#x60;'
};
module.exports = staticEscapeMap;

/***/ }),

/***/ 3941:
/***/ ((module) => {

var staticHGKeyRE = /(.+)?\[(\d+)\]$/;
module.exports = staticHGKeyRE;

/***/ }),

/***/ 7522:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticStrUndefined = __webpack_require__(4194);

/* eslint-disable valid-typeof */
var staticLocation = typeof location === staticStrUndefined ? 0 : location;
module.exports = staticLocation;

/***/ }),

/***/ 1081:
/***/ ((module) => {

var objectToString = Object.prototype.toString;
module.exports = objectToString;

/***/ }),

/***/ 7524:
/***/ ((module) => {

var staticParseInt = parseInt;
module.exports = staticParseInt;

/***/ }),

/***/ 2457:
/***/ ((module) => {

var staticStrFirst = 'first';
module.exports = staticStrFirst;

/***/ }),

/***/ 7318:
/***/ ((module) => {

var staticStrLast = 'last';
module.exports = staticStrLast;

/***/ }),

/***/ 4194:
/***/ ((module) => {

var staticStrUndefined = 'undefined';
module.exports = staticStrUndefined;

/***/ }),

/***/ 9061:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticDayTime = __webpack_require__(5766);
var staticWeekTime = staticDayTime * 7;
module.exports = staticWeekTime;

/***/ }),

/***/ 7743:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticStrUndefined = __webpack_require__(4194);

/* eslint-disable valid-typeof */
var staticWindow = typeof window === staticStrUndefined ? 0 : window;
module.exports = staticWindow;

/***/ }),

/***/ 4875:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperNumberDecimal = __webpack_require__(2591);
var toNumberString = __webpack_require__(9730);
var toNumber = __webpack_require__(2661);
var toFixed = __webpack_require__(6854);

/**
 * 减法运算
 *
 * @param { Number } num1 被减数
 * @param { Number } num2 减数
 * @return {Number}
 */
function subtract(num1, num2) {
  var subtrahend = toNumber(num1);
  var minuend = toNumber(num2);
  var str1 = toNumberString(subtrahend);
  var str2 = toNumberString(minuend);
  var digit1 = helperNumberDecimal(str1);
  var digit2 = helperNumberDecimal(str2);
  var ratio = Math.pow(10, Math.max(digit1, digit2));
  var precision = digit1 >= digit2 ? digit1 : digit2;
  return parseFloat(toFixed((subtrahend * ratio - minuend * ratio) / ratio, precision));
}
module.exports = subtract;

/***/ }),

/***/ 5515:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperNumberAdd = __webpack_require__(2);
var isFunction = __webpack_require__(7379);
var isArray = __webpack_require__(1297);
var each = __webpack_require__(5360);
var get = __webpack_require__(4192);

/**
  * 求和函数，将数值相加
  *
  * @param {Array} array 数组
  * @param {Function/String} iterate 方法或属性
  * @param {Object} context 上下文
  * @return {Number}
  */
function sum(array, iterate, context) {
  var result = 0;
  each(array && array.length > 2 && isArray(array) ? array.sort() : array, iterate ? isFunction(iterate) ? function () {
    result = helperNumberAdd(result, iterate.apply(context, arguments));
  } : function (val) {
    result = helperNumberAdd(result, get(val, iterate));
  } : function (val) {
    result = helperNumberAdd(result, val);
  });
  return result;
}
module.exports = sum;

/***/ }),

/***/ 1955:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var setupDefaults = __webpack_require__(1450);
var toValueString = __webpack_require__(6220);
var trim = __webpack_require__(6965);
var get = __webpack_require__(4192);

/**
 * 解析动态字符串模板
 * @param {atring} str 字符串模板
 * @param {any | any[]} args 对象
 * @param {any} options 
 */
function template(str, args, options) {
  return toValueString(str).replace((options || setupDefaults).tmplRE || /\{{2}([.\w[\]\s]+)\}{2}/g, function (match, key) {
    return get(args, trim(key));
  });
}
module.exports = template;

/***/ }),

/***/ 207:
/***/ ((module) => {

/**
  * 节流函数；当被调用 n 毫秒后才会执行，如果在这时间内又被调用则至少每隔 n 秒毫秒调用一次该函数
  *
  * @param {Function} callback 回调
  * @param {Number} wait 多少秒毫
  * @param {Object} options 参数{leading: 是否在之前执行, trailing: 是否在之后执行}
  * @return {Function}
  */
function throttle(callback, wait, options) {
  var args = null;
  var context = null;
  var opts = options || {};
  var runFlag = false;
  var timeout = null;
  var optLeading = 'leading' in opts ? opts.leading : true;
  var optTrailing = 'trailing' in opts ? opts.trailing : false;
  var gcFn = function () {
    args = null;
    context = null;
  };
  var runFn = function () {
    runFlag = true;
    callback.apply(context, args);
    timeout = setTimeout(endFn, wait);
    gcFn();
  };
  var endFn = function () {
    timeout = null;
    if (!runFlag && optTrailing === true) {
      runFn();
    }
  };
  var cancelFn = function () {
    var rest = timeout !== null;
    if (rest) {
      clearTimeout(timeout);
    }
    gcFn();
    timeout = null;
    runFlag = false;
    return rest;
  };
  var throttled = function () {
    args = arguments;
    context = this;
    runFlag = false;
    if (timeout === null) {
      if (optLeading === true) {
        runFn();
      } else if (optTrailing === true) {
        timeout = setTimeout(endFn, wait);
      }
    }
  };
  throttled.cancel = cancelFn;
  return throttled;
}
module.exports = throttle;

/***/ }),

/***/ 5473:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperGetDateTime = __webpack_require__(4404);
var now = __webpack_require__(3050);
var toStringDate = __webpack_require__(2214);
var isDate = __webpack_require__(6602);

/**
 * 将日期格式化为时间戳
 *
  * @param {String/Number/Date} str 日期或数字
  * @param {String} format 解析日期格式
 * @returns Number
 */
var timestamp = function (str, format) {
  if (str) {
    var date = toStringDate(str, format);
    return isDate(date) ? helperGetDateTime(date) : date;
  }
  return now();
};
module.exports = timestamp;

/***/ }),

/***/ 423:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var map = __webpack_require__(9660);

/**
 * 将对象或者伪数组转为新数组
 *
 * @param {Array} list 数组
 * @return {Array}
 */
function toArray(list) {
  return map(list, function (item) {
    return item;
  });
}
module.exports = toArray;

/***/ }),

/***/ 4600:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/* provided dependency */ var console = __webpack_require__(3639);
var setupDefaults = __webpack_require__(1450);
var map = __webpack_require__(9660);
var orderBy = __webpack_require__(9891);
var clone = __webpack_require__(1696);
var eqNull = __webpack_require__(8878);
var each = __webpack_require__(5360);
var remove = __webpack_require__(4520);
var assign = __webpack_require__(1524);
function strictTree(array, optChildren) {
  each(array, function (item) {
    if (item[optChildren] && !item[optChildren].length) {
      remove(item, optChildren);
    }
  });
}

/**
  * 将一个带层级的数据列表转成树结构
  *
  * @param {Array} array 数组
  * @param {Object} options {strict: false, parentKey: 'parentId', key: 'id', children: 'children', mapChildren: 'children', data: 'data'}
  * @return {Array}
  */
function toArrayTree(array, options) {
  var opts = assign({}, setupDefaults.treeOptions, options);
  var optStrict = opts.strict;
  var optKey = opts.key;
  var optParentKey = opts.parentKey;
  var optChildren = opts.children;
  var optMapChildren = opts.mapChildren;
  var optSortKey = opts.sortKey;
  var optReverse = opts.reverse;
  var optData = opts.data;
  var result = [];
  var treeMap = {};
  var idsMap = {};
  var id, treeData, parentId;
  if (optSortKey) {
    array = orderBy(clone(array), optSortKey);
    if (optReverse) {
      array = array.reverse();
    }
  }
  each(array, function (item) {
    id = item[optKey];
    idsMap[id] = true;
  });
  each(array, function (item) {
    id = item[optKey];
    if (optData) {
      treeData = {};
      treeData[optData] = item;
    } else {
      treeData = item;
    }
    parentId = item[optParentKey];
    treeMap[id] = treeMap[id] || [];
    treeData[optKey] = id;
    treeData[optParentKey] = parentId;
    if (id === parentId) {
      parentId = null;
      console.log('Fix infinite Loop.', item);
    }
    treeMap[parentId] = treeMap[parentId] || [];
    treeMap[parentId].push(treeData);
    treeData[optChildren] = treeMap[id];
    if (optMapChildren) {
      treeData[optMapChildren] = treeMap[id];
    }
    if (!optStrict || optStrict && eqNull(parentId)) {
      if (!idsMap[parentId]) {
        result.push(treeData);
      }
    }
  });
  if (optStrict) {
    strictTree(array, optChildren);
  }
  return result;
}
module.exports = toArrayTree;

/***/ }),

/***/ 7670:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var setupDefaults = __webpack_require__(1450);
var helperStringUpperCase = __webpack_require__(9523);
var helperGetDateFullYear = __webpack_require__(5919);
var helperGetDateMonth = __webpack_require__(3489);
var toStringDate = __webpack_require__(2214);
var getYearWeek = __webpack_require__(9564);
var getYearDay = __webpack_require__(3549);
var assign = __webpack_require__(1524);
var isValidDate = __webpack_require__(8740);
var isFunction = __webpack_require__(7379);
var padStart = __webpack_require__(2819);
function handleCustomTemplate(date, formats, match, value) {
  var format = formats[match];
  if (format) {
    if (isFunction(format)) {
      return format(value, match, date);
    } else {
      return format[value];
    }
  }
  return value;
}
var dateFormatRE = /\[([^\]]+)]|y{2,4}|M{1,2}|d{1,2}|H{1,2}|h{1,2}|m{1,2}|s{1,2}|S{1,3}|Z{1,2}|W{1,2}|D{1,3}|[aAeEq]/g;

/**
  * 日期格式化为字符串，转义符号 []
  *
  * @param {Date} date 日期或数字
  * @param {String} format 输出日期格式(年份(yy|yyyy)、月份(M|MM自动补0)、天(d|dd自动补0)、12小时制(h|hh自动补0)、24小时制(H|HH自动补0)、分钟(m|mm自动补0)、秒(s|ss自动补0)、毫秒(S|SSS自动补0)、D当年的第几天、a/A上午下午、e/E星期几、w当年的第几周、W当月的第几周、q当年第几个季度、Z时区)
  * @param {Object} options {formats: {q: ['日', '一', '二', '三', '四', '五', '六'], E: function (value, match, date) {return '三'}, }} 自定义格式化模板
  * @return {String}
  */
function toDateString(date, format, options) {
  if (date) {
    date = toStringDate(date);
    if (isValidDate(date)) {
      var result = format || setupDefaults.parseDateFormat || setupDefaults.formatString;
      var hours = date.getHours();
      var apm = hours < 12 ? 'am' : 'pm';
      var formats = assign({}, setupDefaults.parseDateRules || setupDefaults.formatStringMatchs, options ? options.formats : null);
      var fy = function (match, length) {
        return ('' + helperGetDateFullYear(date)).substr(4 - length);
      };
      var fM = function (match, length) {
        return padStart(helperGetDateMonth(date) + 1, length, '0');
      };
      var fd = function (match, length) {
        return padStart(date.getDate(), length, '0');
      };
      var fH = function (match, length) {
        return padStart(hours, length, '0');
      };
      var fh = function (match, length) {
        return padStart(hours <= 12 ? hours : hours - 12, length, '0');
      };
      var fm = function (match, length) {
        return padStart(date.getMinutes(), length, '0');
      };
      var fs = function (match, length) {
        return padStart(date.getSeconds(), length, '0');
      };
      var fS = function (match, length) {
        return padStart(date.getMilliseconds(), length, '0');
      };
      var fZ = function (match, length) {
        var zoneHours = date.getTimezoneOffset() / 60 * -1;
        return handleCustomTemplate(date, formats, match, (zoneHours >= 0 ? '+' : '-') + padStart(zoneHours, 2, '0') + (length === 1 ? ':' : '') + '00');
      };
      var fW = function (match, length) {
        return padStart(handleCustomTemplate(date, formats, match, getYearWeek(date, (options ? options.firstDay : null) || setupDefaults.firstDayOfWeek)), length, '0');
      };
      var fD = function (match, length) {
        return padStart(handleCustomTemplate(date, formats, match, getYearDay(date)), length, '0');
      };
      var parseDates = {
        yyyy: fy,
        yy: fy,
        MM: fM,
        M: fM,
        dd: fd,
        d: fd,
        HH: fH,
        H: fH,
        hh: fh,
        h: fh,
        mm: fm,
        m: fm,
        ss: fs,
        s: fs,
        SSS: fS,
        S: fS,
        ZZ: fZ,
        Z: fZ,
        WW: fW,
        W: fW,
        DDD: fD,
        D: fD,
        a: function (match) {
          return handleCustomTemplate(date, formats, match, apm);
        },
        A: function (match) {
          return handleCustomTemplate(date, formats, match, helperStringUpperCase(apm));
        },
        e: function (match) {
          return handleCustomTemplate(date, formats, match, date.getDay());
        },
        E: function (match) {
          return handleCustomTemplate(date, formats, match, date.getDay());
        },
        q: function (match) {
          return handleCustomTemplate(date, formats, match, Math.floor((helperGetDateMonth(date) + 3) / 3));
        }
      };
      return result.replace(dateFormatRE, function (match, skip) {
        return skip || (parseDates[match] ? parseDates[match](match, match.length) : match);
      });
    }
    return 'Invalid Date';
  }
  return '';
}
module.exports = toDateString;

/***/ }),

/***/ 6854:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var round = __webpack_require__(3221);
var toValueString = __webpack_require__(6220);
var helperStringRepeat = __webpack_require__(7388);
var helperNumberOffsetPoint = __webpack_require__(2261);

/**
  * 将数值四舍五入并格式化为固定小数位的字符串
  *
 * @param {string|number} num 数值
 * @param {number} digits 小数保留位数
  * @return {String}
  */
function toFixed(num, digits) {
  digits = digits >> 0;
  var str = toValueString(round(num, digits));
  var nums = str.split('.');
  var intStr = nums[0];
  var floatStr = nums[1] || '';
  var digitOffsetIndex = digits - floatStr.length;
  if (digits) {
    if (digitOffsetIndex > 0) {
      return intStr + '.' + floatStr + helperStringRepeat('0', digitOffsetIndex);
    }
    return intStr + helperNumberOffsetPoint(floatStr, Math.abs(digitOffsetIndex));
  }
  return intStr;
}
module.exports = toFixed;

/***/ }),

/***/ 5844:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var template = __webpack_require__(1955);

/**
 * 字符串格式化占位符
 * @param { string } str 
 * @param { object | any[] } obj 
 */
function toFormatString(str, obj) {
  return template(str, obj, {
    tmplRE: /\{([.\w[\]\s]+)\}/g
  });
}
module.exports = toFormatString;

/***/ }),

/***/ 1212:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticParseInt = __webpack_require__(7524);
var helperCreateToNumber = __webpack_require__(2011);

/**
 * 转整数
 * @param { String/Number } str 数值
 *
 * @return {Number}
 */
var toInteger = helperCreateToNumber(staticParseInt);
module.exports = toInteger;

/***/ }),

/***/ 6769:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var eqNull = __webpack_require__(8878);

/**
  * JSON转字符串
  *
  * @param {Object} obj 对象
  * @return {String} 返回字符串
  */
function toJSONString(obj) {
  return eqNull(obj) ? '' : JSON.stringify(obj);
}
module.exports = toJSONString;

/***/ }),

/***/ 2661:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateToNumber = __webpack_require__(2011);

/**
 * 转数值
 * @param { String/Number } str 数值
 *
 * @return {Number}
 */
var toNumber = helperCreateToNumber(parseFloat);
module.exports = toNumber;

/***/ }),

/***/ 9730:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperStringRepeat = __webpack_require__(7388);
var helperNumberOffsetPoint = __webpack_require__(2261);

/**
 * 数值转字符串，科学计数转字符串
 * @param { Number } num 数值
 *
 * @return {Number}
 */
function toNumberString(num) {
  var rest = '' + num;
  var scienceMatchs = rest.match(/^([-+]?)((\d+)|((\d+)?[.](\d+)?))e([-+]{1})([0-9]+)$/);
  if (scienceMatchs) {
    var isNegative = num < 0;
    var absFlag = isNegative ? '-' : '';
    var intNumStr = scienceMatchs[3] || '';
    var dIntNumStr = scienceMatchs[5] || '';
    var dFloatNumStr = scienceMatchs[6] || '';
    var sciencFlag = scienceMatchs[7];
    var scienceNumStr = scienceMatchs[8];
    var floatOffsetIndex = scienceNumStr - dFloatNumStr.length;
    var intOffsetIndex = scienceNumStr - intNumStr.length;
    var dIntOffsetIndex = scienceNumStr - dIntNumStr.length;
    if (sciencFlag === '+') {
      if (intNumStr) {
        return absFlag + intNumStr + helperStringRepeat('0', scienceNumStr);
      }
      if (floatOffsetIndex > 0) {
        return absFlag + dIntNumStr + dFloatNumStr + helperStringRepeat('0', floatOffsetIndex);
      }
      return absFlag + dIntNumStr + helperNumberOffsetPoint(dFloatNumStr, scienceNumStr);
    }
    if (intNumStr) {
      if (intOffsetIndex > 0) {
        return absFlag + '0.' + helperStringRepeat('0', Math.abs(intOffsetIndex)) + intNumStr;
      }
      return absFlag + helperNumberOffsetPoint(intNumStr, intOffsetIndex);
    }
    if (dIntOffsetIndex > 0) {
      return absFlag + '0.' + helperStringRepeat('0', Math.abs(dIntOffsetIndex)) + dIntNumStr + dFloatNumStr;
    }
    return absFlag + helperNumberOffsetPoint(dIntNumStr, dIntOffsetIndex) + dFloatNumStr;
  }
  return rest;
}
module.exports = toNumberString;

/***/ }),

/***/ 2214:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticParseInt = __webpack_require__(7524);
var helperGetUTCDateTime = __webpack_require__(28);
var helperGetDateTime = __webpack_require__(4404);
var isString = __webpack_require__(3535);
var isDate = __webpack_require__(6602);
function getParseRule(txt) {
  return '(\\d{' + txt + '})';
}
function toParseMs(num) {
  if (num < 10) {
    return num * 100;
  } else if (num < 100) {
    return num * 10;
  }
  return num;
}
function toParseNum(num) {
  return isNaN(num) ? num : staticParseInt(num);
}
var d2 = getParseRule(2);
var d1or2 = getParseRule('1,2');
var d1or7 = getParseRule('1,7');
var d3or4 = getParseRule('3,4');
var place = '.{1}';
var d1Or2RE = place + d1or2;
var dzZ = '(([zZ])|([-+]\\d{2}:?\\d{2}))';
var defaulParseStrs = [d3or4, d1Or2RE, d1Or2RE, d1Or2RE, d1Or2RE, d1Or2RE, place + d1or7, dzZ];
var defaulParseREs = [];
for (var len = defaulParseStrs.length - 1; len >= 0; len--) {
  var rule = '';
  for (var i = 0; i < len + 1; i++) {
    rule += defaulParseStrs[i];
  }
  defaulParseREs.push(new RegExp('^' + rule + '$'));
}

/**
 * 解析默认格式
 */
function parseDefaultRules(str) {
  var matchRest,
    resMaps = {};
  for (var i = 0, dfrLen = defaulParseREs.length; i < dfrLen; i++) {
    matchRest = str.match(defaulParseREs[i]);
    if (matchRest) {
      resMaps.y = matchRest[1];
      resMaps.M = matchRest[2];
      resMaps.d = matchRest[3];
      resMaps.H = matchRest[4];
      resMaps.m = matchRest[5];
      resMaps.s = matchRest[6];
      resMaps.S = matchRest[7];
      resMaps.Z = matchRest[8];
      break;
    }
  }
  return resMaps;
}
var customParseStrs = [['yyyy', d3or4], ['yy', d2], ['MM', d2], ['M', d1or2], ['dd', d2], ['d', d1or2], ['HH', d2], ['H', d1or2], ['mm', d2], ['m', d1or2], ['ss', d2], ['s', d1or2], ['SSS', getParseRule(3)], ['S', d1or7], ['Z', dzZ]];
var parseRuleMaps = {};
var parseRuleKeys = ['\\[([^\\]]+)\\]'];
for (var i = 0; i < customParseStrs.length; i++) {
  var itemRule = customParseStrs[i];
  parseRuleMaps[itemRule[0]] = itemRule[1] + '?';
  parseRuleKeys.push(itemRule[0]);
}
var customParseRes = new RegExp(parseRuleKeys.join('|'), 'g');
var cacheFormatMaps = {};

/**
 * 解析自定义格式
 */
function parseCustomRules(str, format) {
  var cacheItem = cacheFormatMaps[format];
  if (!cacheItem) {
    var posIndexs = [];
    var re = format.replace(/([$(){}*+.?\\^|])/g, "\\$1").replace(customParseRes, function (text, val) {
      var firstChar = text.charAt(0);
      // 如果为转义符号:[关键字]
      if (firstChar === '[') {
        return val;
      }
      posIndexs.push(firstChar);
      return parseRuleMaps[text];
    });
    cacheItem = cacheFormatMaps[format] = {
      _i: posIndexs,
      _r: new RegExp(re)
    };
  }
  var resMaps = {};
  var matchRest = str.match(cacheItem._r);
  if (matchRest) {
    var _i = cacheItem._i;
    for (var i = 1, len = matchRest.length; i < len; i++) {
      resMaps[_i[i - 1]] = matchRest[i];
    }
    return resMaps;
  }
  return resMaps;
}

/**
 * 解析时区
 */
function parseTimeZone(resMaps) {
  // 如果为UTC 时间
  if (/^[zZ]/.test(resMaps.Z)) {
    return new Date(helperGetUTCDateTime(resMaps));
  } else {
    // 如果指定时区，时区转换
    var matchRest = resMaps.Z.match(/([-+])(\d{2}):?(\d{2})/);
    if (matchRest) {
      return new Date(helperGetUTCDateTime(resMaps) - (matchRest[1] === '-' ? -1 : 1) * staticParseInt(matchRest[2]) * 3600000 + staticParseInt(matchRest[3]) * 60000);
    }
  }
  return new Date('');
}

/**
  * 字符串转为日期
  *
  * @param {String/Number/Date} str 日期或数字
  * @param {String} format 解析日期格式(yyyy年份、MM月份、dd天、hh(12)HH(24)小时、mm分钟、ss秒、SSS毫秒、Z时区)
  * @return {Date}
  */
function toStringDate(str, format) {
  if (str) {
    var isDType = isDate(str);
    if (isDType || !format && /^[0-9]{11,15}$/.test(str)) {
      return new Date(isDType ? helperGetDateTime(str) : staticParseInt(str));
    }
    if (isString(str)) {
      var resMaps = format ? parseCustomRules(str, format) : parseDefaultRules(str);
      if (resMaps.y) {
        if (resMaps.M) {
          resMaps.M = toParseNum(resMaps.M) - 1;
        }
        if (resMaps.S) {
          // 如果7位则是微秒，只精确到3位毫秒
          resMaps.S = toParseMs(toParseNum(resMaps.S.substring(0, 3)));
        }
        if (resMaps.Z) {
          return parseTimeZone(resMaps);
        } else {
          return new Date(resMaps.y, resMaps.M || 0, resMaps.d || 1, resMaps.H || 0, resMaps.m || 0, resMaps.s || 0, resMaps.S || 0);
        }
      }
    }
  }
  return new Date('');
}
module.exports = toStringDate;

/***/ }),

/***/ 3413:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var isPlainObject = __webpack_require__(7143);
var isString = __webpack_require__(3535);

/**
  * 字符串转JSON
  *
  * @param {String} str 字符串
  * @return {Object} 返回转换后对象
  */
function toStringJSON(str) {
  if (isPlainObject(str)) {
    return str;
  } else if (isString(str)) {
    try {
      return JSON.parse(str);
    } catch (e) {}
  }
  return {};
}
module.exports = toStringJSON;

/***/ }),

/***/ 5812:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var setupDefaults = __webpack_require__(1450);
var arrayEach = __webpack_require__(1418);
var assign = __webpack_require__(1524);
function unTreeList(result, parentItem, array, opts) {
  var optKey = opts.key;
  var optParentKey = opts.parentKey;
  var optChildren = opts.children;
  var optData = opts.data;
  var optUpdated = opts.updated;
  var optClear = opts.clear;
  arrayEach(array, function (item) {
    var childList = item[optChildren];
    if (optData) {
      item = item[optData];
    }
    if (optUpdated !== false) {
      item[optParentKey] = parentItem ? parentItem[optKey] : null;
    }
    result.push(item);
    if (childList && childList.length) {
      unTreeList(result, item, childList, opts);
    }
    if (optClear) {
      delete item[optChildren];
    }
  });
  return result;
}

/**
  * 将一个树结构转成数组列表
  *
  * @param {Array} array 数组
  * @param {Object} options { children: 'children', data: 'data', clear: false }
  * @return {Array}
  */
function toTreeArray(array, options) {
  return unTreeList([], null, array, assign({}, setupDefaults.treeOptions, options));
}
module.exports = toTreeArray;

/***/ }),

/***/ 6220:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var eqNull = __webpack_require__(8878);
var isNumber = __webpack_require__(504);
var toNumberString = __webpack_require__(9730);
function toValueString(obj) {
  if (isNumber(obj)) {
    return toNumberString(obj);
  }
  return '' + (eqNull(obj) ? '' : obj);
}
module.exports = toValueString;

/***/ }),

/***/ 6965:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var trimRight = __webpack_require__(7546);
var trimLeft = __webpack_require__(5024);

/**
  * 去除字符串左右两边的空格
  *
  * @param {String} str 字符串
  * @return {String}
  */
function trim(str) {
  return str && str.trim ? str.trim() : trimRight(trimLeft(str));
}
module.exports = trim;

/***/ }),

/***/ 5024:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var toValueString = __webpack_require__(6220);

/**
  * 去除字符串左边的空格
  *
  * @param {String} str 字符串
  * @return {String}
  */
function trimLeft(str) {
  return str && str.trimLeft ? str.trimLeft() : toValueString(str).replace(/^[\s\uFEFF\xA0]+/g, '');
}
module.exports = trimLeft;

/***/ }),

/***/ 7546:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var toValueString = __webpack_require__(6220);

/**
  * 去除字符串右边的空格
  *
  * @param {String} str 字符串
  * @return {String}
  */
function trimRight(str) {
  return str && str.trimRight ? str.trimRight() : toValueString(str).replace(/[\s\uFEFF\xA0]+$/g, '');
}
module.exports = trimRight;

/***/ }),

/***/ 2340:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticEscapeMap = __webpack_require__(6083);
var helperFormatEscaper = __webpack_require__(3277);
var each = __webpack_require__(5360);
var unescapeMap = {};
each(staticEscapeMap, function (item, key) {
  unescapeMap[staticEscapeMap[key]] = key;
});

/**
  * 反转escape
  *
  * @param {String} str 字符串
  * @return {String}
  */
var unescape = helperFormatEscaper(unescapeMap);
module.exports = unescape;

/***/ }),

/***/ 5628:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var uniq = __webpack_require__(3755);
var toArray = __webpack_require__(423);

/**
  * 将多个数的值返回唯一的并集数组
  *
  * @param {...Array} 数组
  * @return {Array}
  */
function union() {
  var args = arguments;
  var result = [];
  var index = 0;
  var len = args.length;
  for (; index < len; index++) {
    result = result.concat(toArray(args[index]));
  }
  return uniq(result);
}
module.exports = union;

/***/ }),

/***/ 3755:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var each = __webpack_require__(5360);
var includes = __webpack_require__(9916);
var isFunction = __webpack_require__(7379);
var property = __webpack_require__(7160);

/**
 * 数组去重
 * 
 * @param {*} array  数组
 * @param {*} iterate 字段或回调
 * @param {*} context 
 * @returns 
 */
function uniq(array, iterate, context) {
  var result = [];
  if (iterate) {
    if (!isFunction(iterate)) {
      iterate = property(iterate);
    }
    var val,
      valMap = {};
    each(array, function (item, key) {
      val = iterate.call(context, item, key, array);
      if (!valMap[val]) {
        valMap[val] = 1;
        result.push(item);
      }
    });
  } else {
    each(array, function (value) {
      if (!includes(result, value)) {
        result.push(value);
      }
    });
  }
  return result;
}
module.exports = uniq;

/***/ }),

/***/ 9995:
/***/ ((module) => {

/**
  * 获取一个全局唯一标识
  *
  * @param {String} prefix 前缀
  * @return {Number}
  */
var __uniqueId = 0;
function uniqueId(prefix) {
  return [prefix, ++__uniqueId].join('');
}
module.exports = uniqueId;

/***/ }),

/***/ 2510:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var staticDecodeURIComponent = __webpack_require__(5709);
var arrayEach = __webpack_require__(1418);
var isString = __webpack_require__(3535);

/**
 * 反序列化查询参数
 * @param {String} query 字符串
 */
function unserialize(str) {
  var items;
  var result = {};
  if (str && isString(str)) {
    arrayEach(str.split('&'), function (param) {
      items = param.split('=');
      result[staticDecodeURIComponent(items[0])] = staticDecodeURIComponent(items[1] || '');
    });
  }
  return result;
}
module.exports = unserialize;

/***/ }),

/***/ 9627:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var pluck = __webpack_require__(624);
var max = __webpack_require__(4475);

/**
 * 与 zip 相反
 *
 * @param {Array} arrays 数组集合
 */
function unzip(arrays) {
  var index, maxItem, len;
  var result = [];
  if (arrays && arrays.length) {
    index = 0;
    maxItem = max(arrays, function (item) {
      return item ? item.length : 0;
    });
    for (len = maxItem ? maxItem.length : 0; index < len; index++) {
      result.push(pluck(arrays, index));
    }
  }
  return result;
}
module.exports = unzip;

/***/ }),

/***/ 3656:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var helperCreateGetObjects = __webpack_require__(1137);

/**
  * 获取对象所有值
  *
  * @param {Object} obj 对象/数组
  * @return {Array}
  */
var values = helperCreateGetObjects('values', 0);
module.exports = values;

/***/ }),

/***/ 6581:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var unzip = __webpack_require__(9627);

/**
 * 将每个数组中相应位置的值合并在一起
 *
 * @param {Array*} array 数组
 */
function zip() {
  return unzip(arguments);
}
module.exports = zip;

/***/ }),

/***/ 478:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var values = __webpack_require__(3656);
var each = __webpack_require__(5360);

/**
 * 根据键数组、值数组对转换为对象
 *
 * @param {Array} props 键数组
 * @param {Number} arr 值数组
 * @return {Object}
 */
function zipObject(props, arr) {
  var result = {};
  arr = arr || [];
  each(values(props), function (val, key) {
    result[val] = arr[key];
  });
  return result;
}
module.exports = zipObject;

/***/ }),

/***/ 7086:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var possibleNames = ['BigInt64Array', 'BigUint64Array', 'Float32Array', 'Float64Array', 'Int16Array', 'Int32Array', 'Int8Array', 'Uint16Array', 'Uint32Array', 'Uint8Array', 'Uint8ClampedArray'];
var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis;
module.exports = function availableTypedArrays() {
  var out = [];
  for (var i = 0; i < possibleNames.length; i++) {
    if (typeof g[possibleNames[i]] === 'function') {
      out[out.length] = possibleNames[i];
    }
  }
  return out;
};

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/compat get default export */
/******/ 	(() => {
/******/ 		// getDefaultExport function for compatibility with non-harmony modules
/******/ 		__webpack_require__.n = (module) => {
/******/ 			var getter = module && module.__esModule ?
/******/ 				() => (module['default']) :
/******/ 				() => (module);
/******/ 			__webpack_require__.d(getter, { a: getter });
/******/ 			return getter;
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	(() => {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = (exports, definition) => {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/global */
/******/ 	(() => {
/******/ 		__webpack_require__.g = (function() {
/******/ 			if (typeof globalThis === 'object') return globalThis;
/******/ 			try {
/******/ 				return this || new Function('return this')();
/******/ 			} catch (e) {
/******/ 				if (typeof window === 'object') return window;
/******/ 			}
/******/ 		})();
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	(() => {
/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	(() => {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = (exports) => {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/publicPath */
/******/ 	(() => {
/******/ 		__webpack_require__.p = "";
/******/ 	})();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  http: () => (/* reexport */ api),
  utils: () => (/* reexport */ utils)
});

;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
/* eslint-disable no-var */
// This file is imported into lib/wc client bundles.

if (typeof window !== 'undefined') {
  var currentScript = window.document.currentScript
  if (false) { var getCurrentScript; }

  var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
  if (src) {
    __webpack_require__.p = src[1] // eslint-disable-line
  }
}

// Indicate to webpack that this file can be concatenated
/* harmony default export */ const setPublicPath = (null);

;// CONCATENATED MODULE: ./packages/api/index.js
// fetch文档： https://developer.mozilla.org/en-US/docs/Web/API/fetch

class HttpRequest {
  constructor(options = {}) {
    this.options = options;
  }
  setOptions(options) {
    this.options = options;
  }
  joinPaths(start, end) {
    if (!start.endsWith('/') && !end.startsWith('/')) return `${start}/${end}`;
    return `${start}${end}`;
  }
  request(method, url, params, options) {
    return new Promise(async (resolve, reject) => {
      try {
        const fetchController = new AbortController();
        let fetchOptions = Object.assign({}, this.options, {
          method: method
        }, options);
        let fetchHeader = Object.assign({}, this.options?.header, options?.header);
        fetchOptions.url = url;
        fetchOptions.signal = fetchController.signal;
        fetchOptions.controller = fetchController;
        fetchOptions.headers = new Headers(fetchHeader);
        let fetchUrl = fetchOptions.baseURL ? this.joinPaths(fetchOptions.baseURL, url) : url;
        let fetchRequest = await this.requestInterceptors(fetchOptions);
        let timer = null;
        if (fetchOptions.timeout) {
          timer = setTimeout(() => {
            fetchController.abort();
            throw new Error('fetch timout');
          }, fetchOptions.timeout);
        }
        let fetchResponse = await fetch(fetchUrl, fetchRequest);
        if (timer) clearTimeout(timer);
        let fetchResult = await this.responseInterceptors(fetchResponse, fetchRequest);
        resolve(fetchResult);
      } catch (e) {
        reject(e);
      }
    });
  }
  get(url, params, options) {
    return this.request('GET', url, params, options);
  }
  post(url, params, options) {
    return this.request('POST', url, params, options);
  }
  put(url, params, options) {
    return this.request('PUT', url, params, options);
  }
  delete(url, params, options) {
    return this.request('DELETE', url, params, options);
  }
  patch(url, params, options) {
    return this.request('PATCH', url, params, options);
  }
  // 请求拦截器
  requestInterceptors(request) {
    return request;
  }
  // 响应拦截器
  async responseInterceptors(response, request) {
    let resBody = response;
    if (request.bodyType === 'json') {
      resBody = await response.json();
    }
    return resBody;
  }
}
/* harmony default export */ const api = (HttpRequest);
// EXTERNAL MODULE: ./node_modules/xe-utils/index.js
var xe_utils = __webpack_require__(8961);
var xe_utils_default = /*#__PURE__*/__webpack_require__.n(xe_utils);
;// CONCATENATED MODULE: ./packages/utils/array.js
const removeTree = (treeData, func, options) => {
  treeData.forEach((node, nodeIndex) => {
    if (func && func(node, nodeIndex)) {
      treeData.splice(nodeIndex, 1);
    }
    // 对树节点的后代进行递归
    const child = node[options?.children || 'children'];
    if (child && child.length > 0) {
      removeTree(child, func, options);
    }
  });
};
/* harmony default export */ const array = ({
  removeTree,
  swapArray(arr, toIndex, fromIndex) {
    let currRow = arr.splice(fromIndex, 1)[0];
    arr.splice(toIndex, 0, currRow);
    return arr;
  }
});
;// CONCATENATED MODULE: ./packages/utils/string.js


// 数据格式化获取keys
function getFormatKeys(format) {
  let regR = new RegExp('({[a-zA-Z0-9_.]*})', 'ig');
  let formatStr = String(format);
  return (formatStr.match(regR) || []).map((key, keyIndex) => {
    return key.replace(/{|}/gi, '');
  });
}

// 格式化数据结构
function format(format, data, toNumber) {
  let keys = getFormatKeys(format);
  let formatStr = String(format);
  keys.map((key, indexkey) => {
    let value = xe_utils_default().get(data, key) || '';
    if (toNumber) value = xe_utils_default().toNumber(value);
    formatStr = formatStr.replace(new RegExp('{' + key + '}', 'ig'), value);
  });
  return formatStr;
}

// 生成随机字符串
function randomStr(len = 32) {
  const $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
  const maxPos = $chars.length;
  let str = '';
  for (let i = 0; i < len; i++) {
    str += $chars.charAt(Math.floor(Math.random() * maxPos));
  }
  return str;
}
/* harmony default export */ const string = ({
  randomStr,
  getFormatKeys,
  format,
  replaceNutrim(str) {
    return String(str).replace(/undefined|(^\s*)|(\s*$)/gi, '');
  },
  replaceAll(str, from, to) {
    // 替换全部 将str中的所有from替换为to
    return str.replace(new RegExp(from, 'gm'), to);
  },
  filterTag(str) {
    /* 过滤html代码(把<>转换字符串) */
    let me = this;
    str = me.replaceAll(str, /&/gi, '&amp;');
    str = me.replaceAll(str, /</gi, '&lt;');
    str = me.replaceAll(str, />/gi, '&gt;');
    str = me.replaceAll(str, ' ', '&nbsp;');
    return str;
  }
});
// EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js
var tiny_emitter = __webpack_require__(9472);
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/helper/number.mjs
/**
 * Convert value into number.
 *
 * @param {String|Number} number
 * @returns {*}
 */
function toNumber(number) {
  var result;
  if (typeof number === 'number') {
    result = number;
  } else if (typeof number === 'string') {
    result = number.indexOf('.') > -1 ? parseFloat(number) : parseInt(number, 10);
  }
  return result;
}
/**
 * Invert provided number.
 *
 * @param {Number} number
 * @returns {Number} Returns inverted number.
 */

function invertNumber(number) {
  return -1 * toNumber(number);
}
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/error.mjs
var _errors;
function _defineProperty(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, {
      value: value,
      enumerable: true,
      configurable: true,
      writable: true
    });
  } else {
    obj[key] = value;
  }
  return obj;
}
var ERROR = 'ERROR';
var ERROR_DIV_ZERO = 'DIV/0';
var ERROR_NAME = 'NAME';
var ERROR_NOT_AVAILABLE = 'N/A';
var ERROR_NULL = 'NULL';
var ERROR_NUM = 'NUM';
var ERROR_REF = 'REF';
var ERROR_VALUE = 'VALUE';
var errors = (_errors = {}, _defineProperty(_errors, ERROR, '#ERROR!'), _defineProperty(_errors, ERROR_DIV_ZERO, '#DIV/0!'), _defineProperty(_errors, ERROR_NAME, '#NAME?'), _defineProperty(_errors, ERROR_NOT_AVAILABLE, '#N/A'), _defineProperty(_errors, ERROR_NULL, '#NULL!'), _defineProperty(_errors, ERROR_NUM, '#NUM!'), _defineProperty(_errors, ERROR_REF, '#REF!'), _defineProperty(_errors, ERROR_VALUE, '#VALUE!'), _errors);
/**
 * Return error type based on provided error id.
 *
 * @param {String} type Error type.
 * @returns {String|null} Returns error id.
 */

function error_error(type) {
  var result;
  type = (type + '').replace(/#|!|\?/g, '');
  if (errors[type]) {
    result = errors[type];
  }
  return result ? result : null;
}
/**
 * Check if error type is strict valid with knows errors.
 *
 * @param {String} Error type.
 * @return {Boolean}
 */

function isValidStrict(type) {
  var valid = false;
  for (var i in errors) {
    if (Object.prototype.hasOwnProperty.call(errors, i) && errors[i] === type) {
      valid = true;
      break;
    }
  }
  return valid;
}
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/evaluate-by-operator/operator/add.mjs


var SYMBOL = '+';
function func(first) {
  for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    rest[_key - 1] = arguments[_key];
  }
  var result = rest.reduce(function (acc, value) {
    return acc + toNumber(value);
  }, toNumber(first));
  if (isNaN(result)) {
    throw Error(ERROR_VALUE);
  }
  return result;
}
func.SYMBOL = SYMBOL;
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/evaluate-by-operator/operator/ampersand.mjs
var ampersand_SYMBOL = '&';
function ampersand_func() {
  for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
    params[_key] = arguments[_key];
  }
  return params.reduce(function (acc, value) {
    return acc + value.toString();
  }, '');
}
ampersand_func.SYMBOL = ampersand_SYMBOL;
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/evaluate-by-operator/operator/divide.mjs


var divide_SYMBOL = '/';
function divide_func(first) {
  for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    rest[_key - 1] = arguments[_key];
  }
  var result = rest.reduce(function (acc, value) {
    return acc / toNumber(value);
  }, toNumber(first));
  if (result === Infinity) {
    throw Error(ERROR_DIV_ZERO);
  }
  if (isNaN(result)) {
    throw Error(ERROR_VALUE);
  }
  return result;
}
divide_func.SYMBOL = divide_SYMBOL;
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/evaluate-by-operator/operator/equal.mjs
var equal_SYMBOL = '=';
function equal_func(exp1, exp2) {
  return exp1 === exp2;
}
equal_func.SYMBOL = equal_SYMBOL;
// EXTERNAL MODULE: ./node_modules/@handsontable/formulajs/index.js
var formulajs = __webpack_require__(2790);
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/supported-formulas.mjs
var SUPPORTED_FORMULAS = ['ABS', 'ACCRINT', 'ACOS', 'ACOSH', 'ACOT', 'ACOTH', 'ADD', 'AGGREGATE', 'AND', 'ARABIC', 'ARGS2ARRAY', 'ASIN', 'ASINH', 'ATAN', 'ATAN2', 'ATANH', 'AVEDEV', 'AVERAGE', 'AVERAGEA', 'AVERAGEIF', 'AVERAGEIFS', 'BASE', 'BESSELI', 'BESSELJ', 'BESSELK', 'BESSELY', 'BETA.DIST', 'BETA.INV', 'BETADIST', 'BETAINV', 'BIN2DEC', 'BIN2HEX', 'BIN2OCT', 'BINOM.DIST', 'BINOM.DIST.RANGE', 'BINOM.INV', 'BINOMDIST', 'BITAND', 'BITLSHIFT', 'BITOR', 'BITRSHIFT', 'BITXOR', 'CEILING', 'CEILINGMATH', 'CEILINGPRECISE', 'CHAR', 'CHISQ.DIST', 'CHISQ.DIST.RT', 'CHISQ.INV', 'CHISQ.INV.RT', 'CHOOSE', 'CHOOSE', 'CLEAN', 'CODE', 'COLUMN', 'COLUMNS', 'COMBIN', 'COMBINA', 'COMPLEX', 'CONCATENATE', 'CONFIDENCE', 'CONFIDENCE.NORM', 'CONFIDENCE.T', 'CONVERT', 'CORREL', 'COS', 'COSH', 'COT', 'COTH', 'COUNT', 'COUNTA', 'COUNTBLANK', 'COUNTIF', 'COUNTIFS', 'COUNTIN', 'COUNTUNIQUE', 'COVARIANCE.P', 'COVARIANCE.S', 'CSC', 'CSCH', 'CUMIPMT', 'CUMPRINC', 'DATE', 'DATEVALUE', 'DAY', 'DAYS', 'DAYS360', 'DB', 'DDB', 'DEC2BIN', 'DEC2HEX', 'DEC2OCT', 'DECIMAL', 'DEGREES', 'DELTA', 'DEVSQ', 'DIVIDE', 'DOLLARDE', 'DOLLARFR', 'E', 'EDATE', 'EFFECT', 'EOMONTH', 'EQ', 'ERF', 'ERFC', 'EVEN', 'EXACT', 'EXP', 'EXPON.DIST', 'EXPONDIST', 'F.DIST', 'F.DIST.RT', 'F.INV', 'F.INV.RT', 'FACT', 'FACTDOUBLE', 'FALSE', 'FDIST', 'FDISTRT', 'FIND', 'FINV', 'FINVRT', 'FISHER', 'FISHERINV', 'FLATTEN', 'FLOOR', 'FORECAST', 'FREQUENCY', 'FV', 'FVSCHEDULE', 'GAMMA', 'GAMMA.DIST', 'GAMMA.INV', 'GAMMADIST', 'GAMMAINV', 'GAMMALN', 'GAMMALN.PRECISE', 'GAUSS', 'GCD', 'GEOMEAN', 'GESTEP', 'GROWTH', 'GTE', 'HARMEAN', 'HEX2BIN', 'HEX2DEC', 'HEX2OCT', 'HOUR', 'HTML2TEXT', 'HYPGEOM.DIST', 'HYPGEOMDIST', 'IF', 'IMABS', 'IMAGINARY', 'IMARGUMENT', 'IMCONJUGATE', 'IMCOS', 'IMCOSH', 'IMCOT', 'IMCSC', 'IMCSCH', 'IMDIV', 'IMEXP', 'IMLN', 'IMLOG10', 'IMLOG2', 'IMPOWER', 'IMPRODUCT', 'IMREAL', 'IMSEC', 'IMSECH', 'IMSIN', 'IMSINH', 'IMSQRT', 'IMSUB', 'IMSUM', 'IMTAN', 'INT', 'INTERCEPT', 'INTERVAL', 'IPMT', 'IRR', 'ISBINARY', 'ISBLANK', 'ISEVEN', 'ISLOGICAL', 'ISNONTEXT', 'ISNUMBER', 'ISODD', 'ISODD', 'ISOWEEKNUM', 'ISPMT', 'ISTEXT', 'JOIN', 'KURT', 'LARGE', 'LCM', 'LEFT', 'LEN', 'LINEST', 'LN', 'LOG', 'LOG10', 'LOGEST', 'LOGNORM.DIST', 'LOGNORM.INV', 'LOGNORMDIST', 'LOGNORMINV', 'LOWER', 'LT', 'LTE', 'MATCH', 'MAX', 'MAXA', 'MEDIAN', 'MID', 'MIN', 'MINA', 'MINUS', 'MINUTE', 'MIRR', 'MOD', 'MODE.MULT', 'MODE.SNGL', 'MODEMULT', 'MODESNGL', 'MONTH', 'MROUND', 'MULTINOMIAL', 'MULTIPLY', 'NE', 'NEGBINOM.DIST', 'NEGBINOMDIST', 'NETWORKDAYS', 'NOMINAL', 'NORM.DIST', 'NORM.INV', 'NORM.S.DIST', 'NORM.S.INV', 'NORMDIST', 'NORMINV', 'NORMSDIST', 'NORMSINV', 'NOT', 'NOW', 'NPER', 'NPV', 'NUMBERS', 'OCT2BIN', 'OCT2DEC', 'OCT2HEX', 'ODD', 'OR', 'PDURATION', 'PEARSON', 'PERCENTILEEXC', 'PERCENTILEINC', 'PERCENTRANKEXC', 'PERCENTRANKINC', 'PERMUT', 'PERMUTATIONA', 'PHI', 'PI', 'PMT', 'POISSON.DIST', 'POISSONDIST', 'POW', 'POWER', 'PPMT', 'PROB', 'PRODUCT', 'PROPER', 'PV', 'QUARTILE.EXC', 'QUARTILE.INC', 'QUARTILEEXC', 'QUARTILEINC', 'QUOTIENT', 'RADIANS', 'RAND', 'RANDBETWEEN', 'RANK.AVG', 'RANK.EQ', 'RANKAVG', 'RANKEQ', 'RATE', 'REFERENCE', 'REGEXEXTRACT', 'REGEXMATCH', 'REGEXREPLACE', 'REPLACE', 'REPT', 'RIGHT', 'ROMAN', 'ROUND', 'ROUNDDOWN', 'ROUNDUP', 'ROW', 'ROWS', 'RRI', 'RSQ', 'SEARCH', 'SEC', 'SECH', 'SECOND', 'SERIESSUM', 'SIGN', 'SIN', 'SINH', 'SKEW', 'SKEW.P', 'SKEWP', 'SLN', 'SLOPE', 'SMALL', 'SPLIT', 'SPLIT', 'SQRT', 'SQRTPI', 'STANDARDIZE', 'STDEV.P', 'STDEV.S', 'STDEVA', 'STDEVP', 'STDEVPA', 'STDEVS', 'STEYX', 'SUBSTITUTE', 'SUBTOTAL', 'SUM', 'SUMIF', 'SUMIFS', 'SUMPRODUCT', 'SUMSQ', 'SUMX2MY2', 'SUMX2PY2', 'SUMXMY2', 'SWITCH', 'SYD', 'T', 'T.DIST', 'T.DIST.2T', 'T.DIST.RT', 'T.INV', 'T.INV.2T', 'TAN', 'TANH', 'TBILLEQ', 'TBILLPRICE', 'TBILLYIELD', 'TDIST', 'TDIST2T', 'TDISTRT', 'TIME', 'TIMEVALUE', 'TINV', 'TINV2T', 'TODAY', 'TRANSPOSE', 'TREND', 'TRIM', 'TRIMMEAN', 'TRUE', 'TRUNC', 'UNICHAR', 'UNICODE', 'UNIQUE', 'UPPER', 'VAR.P', 'VAR.S', 'VARA', 'VARP', 'VARPA', 'VARS', 'WEEKDAY', 'WEEKNUM', 'WEIBULL.DIST', 'WEIBULLDIST', 'WORKDAY', 'XIRR', 'XNPV', 'XOR', 'YEAR', 'YEARFRAC'];
/* harmony default export */ const supported_formulas = (SUPPORTED_FORMULAS);
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/evaluate-by-operator/operator/formula-function.mjs



var formula_function_SYMBOL = supported_formulas;
function formula_function_func(symbol) {
  return function __formulaFunction() {
    symbol = symbol.toUpperCase();
    var symbolParts = symbol.split('.');
    var foundFormula = false;
    var result;
    if (symbolParts.length === 1) {
      if (formulajs[symbolParts[0]]) {
        foundFormula = true;
        result = formulajs[symbolParts[0]].apply(formulajs, arguments);
      }
    } else {
      var length = symbolParts.length;
      var index = 0;
      var nestedFormula = formulajs;
      while (index < length) {
        nestedFormula = nestedFormula[symbolParts[index]];
        index++;
        if (!nestedFormula) {
          nestedFormula = null;
          break;
        }
      }
      if (nestedFormula) {
        foundFormula = true;
        result = nestedFormula.apply(void 0, arguments);
      }
    }
    if (!foundFormula) {
      throw Error(ERROR_NAME);
    }
    return result;
  };
}
formula_function_func.isFactory = true;
formula_function_func.SYMBOL = formula_function_SYMBOL;
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/evaluate-by-operator/operator/greater-than.mjs
var greater_than_SYMBOL = '>';
function greater_than_func(exp1, exp2) {
  return exp1 > exp2;
}
greater_than_func.SYMBOL = greater_than_SYMBOL;
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/evaluate-by-operator/operator/greater-than-or-equal.mjs
var greater_than_or_equal_SYMBOL = '>=';
function greater_than_or_equal_func(exp1, exp2) {
  return exp1 >= exp2;
}
greater_than_or_equal_func.SYMBOL = greater_than_or_equal_SYMBOL;
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/evaluate-by-operator/operator/less-than.mjs
var less_than_SYMBOL = '<';
function less_than_func(exp1, exp2) {
  return exp1 < exp2;
}
less_than_func.SYMBOL = less_than_SYMBOL;
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/evaluate-by-operator/operator/less-than-or-equal.mjs
var less_than_or_equal_SYMBOL = '<=';
function less_than_or_equal_func(exp1, exp2) {
  return exp1 <= exp2;
}
less_than_or_equal_func.SYMBOL = less_than_or_equal_SYMBOL;
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/evaluate-by-operator/operator/minus.mjs


var minus_SYMBOL = '-';
function minus_func(first) {
  for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    rest[_key - 1] = arguments[_key];
  }
  var result = rest.reduce(function (acc, value) {
    return acc - toNumber(value);
  }, toNumber(first));
  if (isNaN(result)) {
    throw Error(ERROR_VALUE);
  }
  return result;
}
minus_func.SYMBOL = minus_SYMBOL;
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/evaluate-by-operator/operator/multiply.mjs


var multiply_SYMBOL = '*';
function multiply_func(first) {
  for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    rest[_key - 1] = arguments[_key];
  }
  var result = rest.reduce(function (acc, value) {
    return acc * toNumber(value);
  }, toNumber(first));
  if (isNaN(result)) {
    throw Error(ERROR_VALUE);
  }
  return result;
}
multiply_func.SYMBOL = multiply_SYMBOL;
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/evaluate-by-operator/operator/not-equal.mjs
var not_equal_SYMBOL = '<>';
function not_equal_func(exp1, exp2) {
  return exp1 !== exp2;
}
not_equal_func.SYMBOL = not_equal_SYMBOL;
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/evaluate-by-operator/operator/power.mjs


var power_SYMBOL = '^';
function power_func(exp1, exp2) {
  var result = Math.pow(toNumber(exp1), toNumber(exp2));
  if (isNaN(result)) {
    throw Error(ERROR_VALUE);
  }
  return result;
}
power_func.SYMBOL = power_SYMBOL;
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/evaluate-by-operator/evaluate-by-operator.mjs
function _toConsumableArray(arr) {
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray(o, minLen) {
  if (!o) return;
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  var n = Object.prototype.toString.call(o).slice(8, -1);
  if (n === "Object" && o.constructor) n = o.constructor.name;
  if (n === "Map" || n === "Set") return Array.from(o);
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _iterableToArray(iter) {
  if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
}
function _arrayWithoutHoles(arr) {
  if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _arrayLikeToArray(arr, len) {
  if (len == null || len > arr.length) len = arr.length;
  for (var i = 0, arr2 = new Array(len); i < len; i++) {
    arr2[i] = arr[i];
  }
  return arr2;
}

/* eslint-disable import/no-named-as-default-member */














var availableOperators = Object.create(null);
/**
 * Evaluate values by operator id.git
 *
 * @param {String} operator Operator id.
 * @param {Array} [params=[]] Arguments to evaluate.
 * @returns {*}
 */

function evaluateByOperator(operator) {
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  operator = operator.toUpperCase();
  if (!availableOperators[operator]) {
    throw Error(ERROR_NAME);
  }
  return availableOperators[operator].apply(availableOperators, _toConsumableArray(params));
}
/**
 * Register operator.
 *
 * @param {String|Array} symbol Symbol to register.
 * @param {Function} func Logic to register for this symbol.
 */

function registerOperation(symbol, func) {
  if (!Array.isArray(symbol)) {
    symbol = [symbol.toUpperCase()];
  }
  symbol.forEach(function (s) {
    if (func.isFactory) {
      availableOperators[s] = func(s);
    } else {
      availableOperators[s] = func;
    }
  });
}
registerOperation(func.SYMBOL, func);
registerOperation(ampersand_func.SYMBOL, ampersand_func);
registerOperation(divide_func.SYMBOL, divide_func);
registerOperation(equal_func.SYMBOL, equal_func);
registerOperation(power_func.SYMBOL, power_func);
registerOperation(formula_function_func.SYMBOL, formula_function_func);
registerOperation(greater_than_func.SYMBOL, greater_than_func);
registerOperation(greater_than_or_equal_func.SYMBOL, greater_than_or_equal_func);
registerOperation(less_than_func.SYMBOL, less_than_func);
registerOperation(less_than_or_equal_func.SYMBOL, less_than_or_equal_func);
registerOperation(multiply_func.SYMBOL, multiply_func);
registerOperation(not_equal_func.SYMBOL, not_equal_func);
registerOperation(minus_func.SYMBOL, minus_func);
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/grammar-parser/grammar-parser.mjs
/* parser generated by jison 0.4.18 */

/*
  Returns a Parser object of the following structure:

  Parser: {
    yy: {}
  }

  Parser.prototype: {
    yy: {},
    trace: function(),
    symbols_: {associative list: name ==> number},
    terminals_: {associative list: number ==> name},
    productions_: [...],
    performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
    table: [...],
    defaultActions: {...},
    parseError: function(str, hash),
    parse: function(input),

    lexer: {
        EOF: 1,
        parseError: function(str, hash),
        setInput: function(input),
        input: function(),
        unput: function(str),
        more: function(),
        less: function(n),
        pastInput: function(),
        upcomingInput: function(),
        showPosition: function(),
        test_match: function(regex_match_array, rule_index),
        next: function(),
        lex: function(),
        begin: function(condition),
        popState: function(),
        _currentRules: function(),
        topState: function(),
        pushState: function(condition),

        options: {
            ranges: boolean           (optional: true ==> token location info will include a .range[] member)
            flex: boolean             (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
            backtrack_lexer: boolean  (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
        },

        performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
        rules: [...],
        conditions: {associative list: name ==> set},
    }
  }


  token location info (@$, _$, etc.): {
    first_line: n,
    last_line: n,
    first_column: n,
    last_column: n,
    range: [start_number, end_number]       (where the numbers are indexes into the input string, regular zero-based)
  }


  the parseError function receives a 'hash' object with these members for lexer and parser errors: {
    text:        (matched text)
    token:       (the produced terminal token, if any)
    line:        (yylineno)
  }
  while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
    loc:         (yylloc)
    expected:    (string describing the set of expected tokens)
    recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
  }
*/
var o = function o(k, v, _o, l) {
    for (_o = _o || {}, l = k.length; l--; _o[k[l]] = v) {
      ;
    }
    return _o;
  },
  $V0 = [1, 5],
  $V1 = [1, 8],
  $V2 = [1, 6],
  $V3 = [1, 7],
  $V4 = [1, 9],
  $V5 = [1, 14],
  $V6 = [1, 15],
  $V7 = [1, 16],
  $V8 = [1, 12],
  $V9 = [1, 13],
  $Va = [1, 17],
  $Vb = [1, 19],
  $Vc = [1, 20],
  $Vd = [1, 21],
  $Ve = [1, 22],
  $Vf = [1, 23],
  $Vg = [1, 24],
  $Vh = [1, 25],
  $Vi = [1, 26],
  $Vj = [1, 27],
  $Vk = [1, 28],
  $Vl = [5, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 29, 30],
  $Vm = [5, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 29, 30, 32],
  $Vn = [5, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 29, 30, 34],
  $Vo = [5, 10, 11, 13, 14, 15, 16, 17, 29, 30],
  $Vp = [5, 10, 13, 14, 15, 16, 29, 30],
  $Vq = [5, 10, 11, 13, 14, 15, 16, 17, 18, 19, 29, 30],
  $Vr = [13, 29, 30];
var parser = {
  trace: function trace() {},
  yy: {},
  symbols_: {
    "error": 2,
    "expressions": 3,
    "expression": 4,
    "EOF": 5,
    "variableSequence": 6,
    "number": 7,
    "STRING": 8,
    "&": 9,
    "=": 10,
    "+": 11,
    "(": 12,
    ")": 13,
    "<": 14,
    ">": 15,
    "NOT": 16,
    "-": 17,
    "*": 18,
    "/": 19,
    "^": 20,
    "FUNCTION": 21,
    "expseq": 22,
    "cell": 23,
    "ABSOLUTE_CELL": 24,
    "RELATIVE_CELL": 25,
    "MIXED_CELL": 26,
    ":": 27,
    "ARRAY": 28,
    ";": 29,
    ",": 30,
    "VARIABLE": 31,
    "DECIMAL": 32,
    "NUMBER": 33,
    "%": 34,
    "ERROR": 35,
    "$accept": 0,
    "$end": 1
  },
  terminals_: {
    5: "EOF",
    8: "STRING",
    9: "&",
    10: "=",
    11: "+",
    12: "(",
    13: ")",
    14: "<",
    15: ">",
    16: "NOT",
    17: "-",
    18: "*",
    19: "/",
    20: "^",
    21: "FUNCTION",
    24: "ABSOLUTE_CELL",
    25: "RELATIVE_CELL",
    26: "MIXED_CELL",
    27: ":",
    28: "ARRAY",
    29: ";",
    30: ",",
    31: "VARIABLE",
    32: "DECIMAL",
    33: "NUMBER",
    34: "%",
    35: "ERROR"
  },
  productions_: [0, [3, 2], [4, 1], [4, 1], [4, 1], [4, 3], [4, 3], [4, 3], [4, 3], [4, 4], [4, 4], [4, 4], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 2], [4, 2], [4, 3], [4, 4], [4, 1], [4, 1], [4, 2], [23, 1], [23, 1], [23, 1], [23, 3], [23, 3], [23, 3], [23, 3], [23, 3], [23, 3], [23, 3], [23, 3], [23, 3], [22, 1], [22, 1], [22, 3], [22, 3], [6, 1], [6, 3], [7, 1], [7, 3], [7, 2], [2, 1]],
  performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate
  /* action[1] */, $$
  /* vstack */, _$
  /* lstack */) {
    /* this == yyval */
    var $0 = $$.length - 1;
    switch (yystate) {
      case 1:
        return $$[$0 - 1];
        break;
      case 2:
        this.$ = yy.callVariable($$[$0][0]);
        break;
      case 3:
        this.$ = yy.toNumber($$[$0]);
        break;
      case 4:
        this.$ = yy.trimEdges($$[$0]);
        break;
      case 5:
        this.$ = yy.evaluateByOperator('&', [$$[$0 - 2], $$[$0]]);
        break;
      case 6:
        this.$ = yy.evaluateByOperator('=', [$$[$0 - 2], $$[$0]]);
        break;
      case 7:
        this.$ = yy.evaluateByOperator('+', [$$[$0 - 2], $$[$0]]);
        break;
      case 8:
        this.$ = $$[$0 - 1];
        break;
      case 9:
        this.$ = yy.evaluateByOperator('<=', [$$[$0 - 3], $$[$0]]);
        break;
      case 10:
        this.$ = yy.evaluateByOperator('>=', [$$[$0 - 3], $$[$0]]);
        break;
      case 11:
        this.$ = yy.evaluateByOperator('<>', [$$[$0 - 3], $$[$0]]);
        break;
      case 12:
        this.$ = yy.evaluateByOperator('NOT', [$$[$0 - 2], $$[$0]]);
        break;
      case 13:
        this.$ = yy.evaluateByOperator('>', [$$[$0 - 2], $$[$0]]);
        break;
      case 14:
        this.$ = yy.evaluateByOperator('<', [$$[$0 - 2], $$[$0]]);
        break;
      case 15:
        this.$ = yy.evaluateByOperator('-', [$$[$0 - 2], $$[$0]]);
        break;
      case 16:
        this.$ = yy.evaluateByOperator('*', [$$[$0 - 2], $$[$0]]);
        break;
      case 17:
        this.$ = yy.evaluateByOperator('/', [$$[$0 - 2], $$[$0]]);
        break;
      case 18:
        this.$ = yy.evaluateByOperator('^', [$$[$0 - 2], $$[$0]]);
        break;
      case 19:
        var n1 = yy.invertNumber($$[$0]);
        this.$ = n1;
        if (isNaN(this.$)) {
          this.$ = 0;
        }
        break;
      case 20:
        var n1 = yy.toNumber($$[$0]);
        this.$ = n1;
        if (isNaN(this.$)) {
          this.$ = 0;
        }
        break;
      case 21:
        this.$ = yy.callFunction($$[$0 - 2]);
        break;
      case 22:
        this.$ = yy.callFunction($$[$0 - 3], $$[$0 - 1]);
        break;
      case 26:
      case 27:
      case 28:
        this.$ = yy.cellValue($$[$0]);
        break;
      case 29:
      case 30:
      case 31:
      case 32:
      case 33:
      case 34:
      case 35:
      case 36:
      case 37:
        this.$ = yy.rangeValue($$[$0 - 2], $$[$0]);
        break;
      case 38:
      case 42:
        this.$ = [$$[$0]];
        break;
      case 39:
        this.$ = yy.trimEdges(yytext).split(',');
        break;
      case 40:
      case 41:
        $$[$0 - 2].push($$[$0]);
        this.$ = $$[$0 - 2];
        break;
      case 43:
        this.$ = Array.isArray($$[$0 - 2]) ? $$[$0 - 2] : [$$[$0 - 2]];
        this.$.push($$[$0]);
        break;
      case 44:
        this.$ = $$[$0];
        break;
      case 45:
        this.$ = ($$[$0 - 2] + '.' + $$[$0]) * 1;
        break;
      case 46:
        this.$ = $$[$0 - 1] * 0.01;
        break;
      case 47:
        this.$ = yy.throwError($$[$0]);
        break;
    }
  },
  table: [{
    2: 11,
    3: 1,
    4: 2,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, {
    1: [3]
  }, {
    5: [1, 18],
    9: $Vb,
    10: $Vc,
    11: $Vd,
    14: $Ve,
    15: $Vf,
    16: $Vg,
    17: $Vh,
    18: $Vi,
    19: $Vj,
    20: $Vk
  }, o($Vl, [2, 2], {
    32: [1, 29]
  }), o($Vl, [2, 3], {
    34: [1, 30]
  }), o($Vl, [2, 4]), {
    2: 11,
    4: 31,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, {
    2: 11,
    4: 32,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, {
    2: 11,
    4: 33,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, {
    12: [1, 34]
  }, o($Vl, [2, 23]), o($Vl, [2, 24], {
    2: 35,
    35: $Va
  }), o($Vm, [2, 42]), o($Vn, [2, 44], {
    32: [1, 36]
  }), o($Vl, [2, 26], {
    27: [1, 37]
  }), o($Vl, [2, 27], {
    27: [1, 38]
  }), o($Vl, [2, 28], {
    27: [1, 39]
  }), o([5, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 29, 30, 35], [2, 47]), {
    1: [2, 1]
  }, {
    2: 11,
    4: 40,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, {
    2: 11,
    4: 41,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, {
    2: 11,
    4: 42,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, {
    2: 11,
    4: 45,
    6: 3,
    7: 4,
    8: $V0,
    10: [1, 43],
    11: $V1,
    12: $V2,
    15: [1, 44],
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, {
    2: 11,
    4: 47,
    6: 3,
    7: 4,
    8: $V0,
    10: [1, 46],
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, {
    2: 11,
    4: 48,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, {
    2: 11,
    4: 49,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, {
    2: 11,
    4: 50,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, {
    2: 11,
    4: 51,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, {
    2: 11,
    4: 52,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, {
    31: [1, 53]
  }, o($Vn, [2, 46]), {
    9: $Vb,
    10: $Vc,
    11: $Vd,
    13: [1, 54],
    14: $Ve,
    15: $Vf,
    16: $Vg,
    17: $Vh,
    18: $Vi,
    19: $Vj,
    20: $Vk
  }, o($Vo, [2, 19], {
    9: $Vb,
    18: $Vi,
    19: $Vj,
    20: $Vk
  }), o($Vo, [2, 20], {
    9: $Vb,
    18: $Vi,
    19: $Vj,
    20: $Vk
  }), {
    2: 11,
    4: 57,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    13: [1, 55],
    17: $V3,
    21: $V4,
    22: 56,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    28: [1, 58],
    31: $V8,
    33: $V9,
    35: $Va
  }, o($Vl, [2, 25]), {
    33: [1, 59]
  }, {
    24: [1, 60],
    25: [1, 61],
    26: [1, 62]
  }, {
    24: [1, 63],
    25: [1, 64],
    26: [1, 65]
  }, {
    24: [1, 66],
    25: [1, 67],
    26: [1, 68]
  }, o($Vl, [2, 5]), o([5, 10, 13, 29, 30], [2, 6], {
    9: $Vb,
    11: $Vd,
    14: $Ve,
    15: $Vf,
    16: $Vg,
    17: $Vh,
    18: $Vi,
    19: $Vj,
    20: $Vk
  }), o($Vo, [2, 7], {
    9: $Vb,
    18: $Vi,
    19: $Vj,
    20: $Vk
  }), {
    2: 11,
    4: 69,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, {
    2: 11,
    4: 70,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, o($Vp, [2, 14], {
    9: $Vb,
    11: $Vd,
    17: $Vh,
    18: $Vi,
    19: $Vj,
    20: $Vk
  }), {
    2: 11,
    4: 71,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, o($Vp, [2, 13], {
    9: $Vb,
    11: $Vd,
    17: $Vh,
    18: $Vi,
    19: $Vj,
    20: $Vk
  }), o([5, 10, 13, 16, 29, 30], [2, 12], {
    9: $Vb,
    11: $Vd,
    14: $Ve,
    15: $Vf,
    17: $Vh,
    18: $Vi,
    19: $Vj,
    20: $Vk
  }), o($Vo, [2, 15], {
    9: $Vb,
    18: $Vi,
    19: $Vj,
    20: $Vk
  }), o($Vq, [2, 16], {
    9: $Vb,
    20: $Vk
  }), o($Vq, [2, 17], {
    9: $Vb,
    20: $Vk
  }), o([5, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 29, 30], [2, 18], {
    9: $Vb
  }), o($Vm, [2, 43]), o($Vl, [2, 8]), o($Vl, [2, 21]), {
    13: [1, 72],
    29: [1, 73],
    30: [1, 74]
  }, o($Vr, [2, 38], {
    9: $Vb,
    10: $Vc,
    11: $Vd,
    14: $Ve,
    15: $Vf,
    16: $Vg,
    17: $Vh,
    18: $Vi,
    19: $Vj,
    20: $Vk
  }), o($Vr, [2, 39]), o($Vn, [2, 45]), o($Vl, [2, 29]), o($Vl, [2, 30]), o($Vl, [2, 31]), o($Vl, [2, 32]), o($Vl, [2, 33]), o($Vl, [2, 34]), o($Vl, [2, 35]), o($Vl, [2, 36]), o($Vl, [2, 37]), o($Vp, [2, 9], {
    9: $Vb,
    11: $Vd,
    17: $Vh,
    18: $Vi,
    19: $Vj,
    20: $Vk
  }), o($Vp, [2, 11], {
    9: $Vb,
    11: $Vd,
    17: $Vh,
    18: $Vi,
    19: $Vj,
    20: $Vk
  }), o($Vp, [2, 10], {
    9: $Vb,
    11: $Vd,
    17: $Vh,
    18: $Vi,
    19: $Vj,
    20: $Vk
  }), o($Vl, [2, 22]), {
    2: 11,
    4: 75,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, {
    2: 11,
    4: 76,
    6: 3,
    7: 4,
    8: $V0,
    11: $V1,
    12: $V2,
    17: $V3,
    21: $V4,
    23: 10,
    24: $V5,
    25: $V6,
    26: $V7,
    31: $V8,
    33: $V9,
    35: $Va
  }, o($Vr, [2, 40], {
    9: $Vb,
    10: $Vc,
    11: $Vd,
    14: $Ve,
    15: $Vf,
    16: $Vg,
    17: $Vh,
    18: $Vi,
    19: $Vj,
    20: $Vk
  }), o($Vr, [2, 41], {
    9: $Vb,
    10: $Vc,
    11: $Vd,
    14: $Ve,
    15: $Vf,
    16: $Vg,
    17: $Vh,
    18: $Vi,
    19: $Vj,
    20: $Vk
  })],
  defaultActions: {
    18: [2, 1]
  },
  parseError: function parseError(str, hash) {
    if (hash.recoverable) {
      this.trace(str);
    } else {
      var error = new Error(str);
      error.hash = hash;
      throw error;
    }
  },
  parse: function parse(input) {
    var self = this,
      stack = [0],
      tstack = [],
      // token stack
      vstack = [null],
      // semantic value stack
      lstack = [],
      // location stack
      table = this.table,
      yytext = '',
      yylineno = 0,
      yyleng = 0,
      recovering = 0,
      TERROR = 2,
      EOF = 1;
    var args = lstack.slice.call(arguments, 1); //this.reductionCount = this.shiftCount = 0;

    var lexer = Object.create(this.lexer);
    var sharedState = {
      yy: {}
    }; // copy state

    for (var k in this.yy) {
      if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
        sharedState.yy[k] = this.yy[k];
      }
    }
    lexer.setInput(input, sharedState.yy);
    sharedState.yy.lexer = lexer;
    sharedState.yy.parser = this;
    if (typeof lexer.yylloc == 'undefined') {
      lexer.yylloc = {};
    }
    var yyloc = lexer.yylloc;
    lstack.push(yyloc);
    var ranges = lexer.options && lexer.options.ranges;
    if (typeof sharedState.yy.parseError === 'function') {
      this.parseError = sharedState.yy.parseError;
    } else {
      this.parseError = Object.getPrototypeOf(this).parseError;
    }
    function popStack(n) {
      stack.length = stack.length - 2 * n;
      vstack.length = vstack.length - n;
      lstack.length = lstack.length - n;
    }
    var lex = function lex() {
      var token;
      token = lexer.lex() || EOF; // if token isn't its numeric value, convert

      if (typeof token !== 'number') {
        token = self.symbols_[token] || token;
      }
      return token;
    };
    var symbol,
      preErrorSymbol,
      state,
      action,
      a,
      r,
      yyval = {},
      p,
      len,
      newState,
      expected;
    while (true) {
      // retreive state number from top of stack
      state = stack[stack.length - 1]; // use default actions if available

      if (this.defaultActions[state]) {
        action = this.defaultActions[state];
      } else {
        if (symbol === null || typeof symbol == 'undefined') {
          symbol = lex();
        } // read action for current state and first input

        action = table[state] && table[state][symbol];
      } // handle parse error

      if (typeof action === 'undefined' || !action.length || !action[0]) {
        // Return the rule stack depth where the nearest error rule can be found.
        // Return FALSE when no error recovery rule was found.
        var locateNearestErrorRecoveryRule = function locateNearestErrorRecoveryRule(state) {
          var stack_probe = stack.length - 1;
          var depth = 0; // try to recover from error

          for (;;) {
            // check for error recovery rule in this state
            if (TERROR.toString() in table[state]) {
              return depth;
            }
            if (state === 0 || stack_probe < 2) {
              return false; // No suitable error recovery rule available.
            }

            stack_probe -= 2; // popStack(1): [symbol, action]

            state = stack[stack_probe];
            ++depth;
          }
        };
        var error_rule_depth;
        var errStr = '';
        if (!recovering) {
          // first see if there's any chance at hitting an error recovery rule:
          error_rule_depth = locateNearestErrorRecoveryRule(state); // Report error

          expected = [];
          for (p in table[state]) {
            if (this.terminals_[p] && p > TERROR) {
              expected.push("'" + this.terminals_[p] + "'");
            }
          }
          if (lexer.showPosition) {
            errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'";
          } else {
            errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
          }
          this.parseError(errStr, {
            text: lexer.match,
            token: this.terminals_[symbol] || symbol,
            line: lexer.yylineno,
            loc: yyloc,
            expected: expected,
            recoverable: error_rule_depth !== false
          });
        } else if (preErrorSymbol !== EOF) {
          error_rule_depth = locateNearestErrorRecoveryRule(state);
        } // just recovered from another error

        if (recovering == 3) {
          if (symbol === EOF || preErrorSymbol === EOF) {
            throw new Error(errStr || 'Parsing halted while starting to recover from another error.');
          } // discard current lookahead and grab another

          yyleng = lexer.yyleng;
          yytext = lexer.yytext;
          yylineno = lexer.yylineno;
          yyloc = lexer.yylloc;
          symbol = lex();
        } // try to recover from error

        if (error_rule_depth === false) {
          throw new Error(errStr || 'Parsing halted. No suitable error recovery rule available.');
        }
        popStack(error_rule_depth);
        preErrorSymbol = symbol == TERROR ? null : symbol; // save the lookahead token

        symbol = TERROR; // insert generic error symbol as new lookahead

        state = stack[stack.length - 1];
        action = table[state] && table[state][TERROR];
        recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
      } // this shouldn't happen, unless resolve defaults are off

      if (action[0] instanceof Array && action.length > 1) {
        throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
      }
      switch (action[0]) {
        case 1:
          // shift
          //this.shiftCount++;
          stack.push(symbol);
          vstack.push(lexer.yytext);
          lstack.push(lexer.yylloc);
          stack.push(action[1]); // push state

          symbol = null;
          if (!preErrorSymbol) {
            // normal execution/no error
            yyleng = lexer.yyleng;
            yytext = lexer.yytext;
            yylineno = lexer.yylineno;
            yyloc = lexer.yylloc;
            if (recovering > 0) {
              recovering--;
            }
          } else {
            // error just occurred, resume old lookahead f/ before error
            symbol = preErrorSymbol;
            preErrorSymbol = null;
          }
          break;
        case 2:
          // reduce
          //this.reductionCount++;
          len = this.productions_[action[1]][1]; // perform semantic action

          yyval.$ = vstack[vstack.length - len]; // default to $$ = $1
          // default location, uses first token for firsts, last for lasts

          yyval._$ = {
            first_line: lstack[lstack.length - (len || 1)].first_line,
            last_line: lstack[lstack.length - 1].last_line,
            first_column: lstack[lstack.length - (len || 1)].first_column,
            last_column: lstack[lstack.length - 1].last_column
          };
          if (ranges) {
            yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
          }
          r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args));
          if (typeof r !== 'undefined') {
            return r;
          } // pop off stack

          if (len) {
            stack = stack.slice(0, -1 * len * 2);
            vstack = vstack.slice(0, -1 * len);
            lstack = lstack.slice(0, -1 * len);
          }
          stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)

          vstack.push(yyval.$);
          lstack.push(yyval._$); // goto new state = table[STATE][NONTERMINAL]

          newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
          stack.push(newState);
          break;
        case 3:
          // accept
          return true;
      }
    }
    return true;
  }
};
/* generated by jison-lex 0.3.4 */

var lexer = function () {
  var lexer = {
    EOF: 1,
    parseError: function parseError(str, hash) {
      if (this.yy.parser) {
        this.yy.parser.parseError(str, hash);
      } else {
        throw new Error(str);
      }
    },
    // resets the lexer, sets new input
    setInput: function setInput(input, yy) {
      this.yy = yy || this.yy || {};
      this._input = input;
      this._more = this._backtrack = this.done = false;
      this.yylineno = this.yyleng = 0;
      this.yytext = this.matched = this.match = '';
      this.conditionStack = ['INITIAL'];
      this.yylloc = {
        first_line: 1,
        first_column: 0,
        last_line: 1,
        last_column: 0
      };
      if (this.options.ranges) {
        this.yylloc.range = [0, 0];
      }
      this.offset = 0;
      return this;
    },
    // consumes and returns one char from the input
    input: function input() {
      var ch = this._input[0];
      this.yytext += ch;
      this.yyleng++;
      this.offset++;
      this.match += ch;
      this.matched += ch;
      var lines = ch.match(/(?:\r\n?|\n).*/g);
      if (lines) {
        this.yylineno++;
        this.yylloc.last_line++;
      } else {
        this.yylloc.last_column++;
      }
      if (this.options.ranges) {
        this.yylloc.range[1]++;
      }
      this._input = this._input.slice(1);
      return ch;
    },
    // unshifts one char (or a string) into the input
    unput: function unput(ch) {
      var len = ch.length;
      var lines = ch.split(/(?:\r\n?|\n)/g);
      this._input = ch + this._input;
      this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len;

      this.offset -= len;
      var oldLines = this.match.split(/(?:\r\n?|\n)/g);
      this.match = this.match.substr(0, this.match.length - 1);
      this.matched = this.matched.substr(0, this.matched.length - 1);
      if (lines.length - 1) {
        this.yylineno -= lines.length - 1;
      }
      var r = this.yylloc.range;
      this.yylloc = {
        first_line: this.yylloc.first_line,
        last_line: this.yylineno + 1,
        first_column: this.yylloc.first_column,
        last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
      };
      if (this.options.ranges) {
        this.yylloc.range = [r[0], r[0] + this.yyleng - len];
      }
      this.yyleng = this.yytext.length;
      return this;
    },
    // When called from action, caches matched text and appends it on next action
    more: function more() {
      this._more = true;
      return this;
    },
    // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
    reject: function reject() {
      if (this.options.backtrack_lexer) {
        this._backtrack = true;
      } else {
        return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }
      return this;
    },
    // retain first n characters of the match
    less: function less(n) {
      this.unput(this.match.slice(n));
    },
    // displays already matched input, i.e. for error messages
    pastInput: function pastInput() {
      var past = this.matched.substr(0, this.matched.length - this.match.length);
      return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, "");
    },
    // displays upcoming input, i.e. for error messages
    upcomingInput: function upcomingInput() {
      var next = this.match;
      if (next.length < 20) {
        next += this._input.substr(0, 20 - next.length);
      }
      return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
    },
    // displays the character position where the lexing error occurred, i.e. for error messages
    showPosition: function showPosition() {
      var pre = this.pastInput();
      var c = new Array(pre.length + 1).join("-");
      return pre + this.upcomingInput() + "\n" + c + "^";
    },
    // test the lexed token: return FALSE when not a match, otherwise return token
    test_match: function test_match(match, indexed_rule) {
      var token, lines, backup;
      if (this.options.backtrack_lexer) {
        // save context
        backup = {
          yylineno: this.yylineno,
          yylloc: {
            first_line: this.yylloc.first_line,
            last_line: this.last_line,
            first_column: this.yylloc.first_column,
            last_column: this.yylloc.last_column
          },
          yytext: this.yytext,
          match: this.match,
          matches: this.matches,
          matched: this.matched,
          yyleng: this.yyleng,
          offset: this.offset,
          _more: this._more,
          _input: this._input,
          yy: this.yy,
          conditionStack: this.conditionStack.slice(0),
          done: this.done
        };
        if (this.options.ranges) {
          backup.yylloc.range = this.yylloc.range.slice(0);
        }
      }
      lines = match[0].match(/(?:\r\n?|\n).*/g);
      if (lines) {
        this.yylineno += lines.length;
      }
      this.yylloc = {
        first_line: this.yylloc.last_line,
        last_line: this.yylineno + 1,
        first_column: this.yylloc.last_column,
        last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
      };
      this.yytext += match[0];
      this.match += match[0];
      this.matches = match;
      this.yyleng = this.yytext.length;
      if (this.options.ranges) {
        this.yylloc.range = [this.offset, this.offset += this.yyleng];
      }
      this._more = false;
      this._backtrack = false;
      this._input = this._input.slice(match[0].length);
      this.matched += match[0];
      token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
      if (this.done && this._input) {
        this.done = false;
      }
      if (token) {
        return token;
      } else if (this._backtrack) {
        // recover context
        for (var k in backup) {
          this[k] = backup[k];
        }
        return false; // rule action called reject() implying the next rule should be tested instead.
      }

      return false;
    },
    // return next match in input
    next: function next() {
      if (this.done) {
        return this.EOF;
      }
      if (!this._input) {
        this.done = true;
      }
      var token, match, tempMatch, index;
      if (!this._more) {
        this.yytext = '';
        this.match = '';
      }
      var rules = this._currentRules();
      for (var i = 0; i < rules.length; i++) {
        tempMatch = this._input.match(this.rules[rules[i]]);
        if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
          match = tempMatch;
          index = i;
          if (this.options.backtrack_lexer) {
            token = this.test_match(tempMatch, rules[i]);
            if (token !== false) {
              return token;
            } else if (this._backtrack) {
              match = false;
              continue; // rule action called reject() implying a rule MISmatch.
            } else {
              // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
              return false;
            }
          } else if (!this.options.flex) {
            break;
          }
        }
      }
      if (match) {
        token = this.test_match(match, rules[index]);
        if (token !== false) {
          return token;
        } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)

        return false;
      }
      if (this._input === "") {
        return this.EOF;
      } else {
        return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }
    },
    // return next match that has a token
    lex: function lex() {
      var r = this.next();
      if (r) {
        return r;
      } else {
        return this.lex();
      }
    },
    // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
    begin: function begin(condition) {
      this.conditionStack.push(condition);
    },
    // pop the previously active lexer condition state off the condition stack
    popState: function popState() {
      var n = this.conditionStack.length - 1;
      if (n > 0) {
        return this.conditionStack.pop();
      } else {
        return this.conditionStack[0];
      }
    },
    // produce the lexer rule set which is active for the currently active lexer condition state
    _currentRules: function _currentRules() {
      if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
        return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
      } else {
        return this.conditions["INITIAL"].rules;
      }
    },
    // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
    topState: function topState(n) {
      n = this.conditionStack.length - 1 - Math.abs(n || 0);
      if (n >= 0) {
        return this.conditionStack[n];
      } else {
        return "INITIAL";
      }
    },
    // alias for begin(condition)
    pushState: function pushState(condition) {
      this.begin(condition);
    },
    // return the number of states currently on the stack
    stateStackSize: function stateStackSize() {
      return this.conditionStack.length;
    },
    options: {},
    performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
      var YYSTATE = YY_START;
      switch ($avoiding_name_collisions) {
        case 0:
          /* skip whitespace */
          break;
        case 1:
          return 8;
          break;
        case 2:
          return 8;
          break;
        case 3:
          return 21;
          break;
        case 4:
          return 35;
          break;
        case 5:
          return 24;
          break;
        case 6:
          return 26;
          break;
        case 7:
          return 26;
          break;
        case 8:
          return 25;
          break;
        case 9:
          return 21;
          break;
        case 10:
          return 31;
          break;
        case 11:
          return 31;
          break;
        case 12:
          return 33;
          break;
        case 13:
          return 28;
          break;
        case 14:
          return 9;
          break;
        case 15:
          return ' ';
          break;
        case 16:
          return 32;
          break;
        case 17:
          return 27;
          break;
        case 18:
          return 29;
          break;
        case 19:
          return 30;
          break;
        case 20:
          return 18;
          break;
        case 21:
          return 19;
          break;
        case 22:
          return 17;
          break;
        case 23:
          return 11;
          break;
        case 24:
          return 20;
          break;
        case 25:
          return 12;
          break;
        case 26:
          return 13;
          break;
        case 27:
          return 15;
          break;
        case 28:
          return 14;
          break;
        case 29:
          return 16;
          break;
        case 30:
          return '"';
          break;
        case 31:
          return "'";
          break;
        case 32:
          return "!";
          break;
        case 33:
          return 10;
          break;
        case 34:
          return 34;
          break;
        case 35:
          return '#';
          break;
        case 36:
          return 5;
          break;
      }
    },
    rules: [/^(?:\s+)/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:[A-Za-z]{1,}[A-Za-z_0-9\.]+(?=[(]))/, /^(?:#[A-Z0-9\/]+(!|\?)?)/, /^(?:\$[A-Za-z]+\$[0-9]+)/, /^(?:\$[A-Za-z]+[0-9]+)/, /^(?:[A-Za-z]+\$[0-9]+)/, /^(?:[A-Za-z]+[0-9]+)/, /^(?:[A-Za-z\.]+(?=[(]))/, /^(?:[A-Za-z]{1,}[A-Za-z_0-9]+)/, /^(?:[A-Za-z_]+)/, /^(?:[0-9]+)/, /^(?:\[(.*)?\])/, /^(?:&)/, /^(?: )/, /^(?:[.])/, /^(?::)/, /^(?:;)/, /^(?:,)/, /^(?:\*)/, /^(?:\/)/, /^(?:-)/, /^(?:\+)/, /^(?:\^)/, /^(?:\()/, /^(?:\))/, /^(?:>)/, /^(?:<)/, /^(?:NOT\b)/, /^(?:")/, /^(?:')/, /^(?:!)/, /^(?:=)/, /^(?:%)/, /^(?:[#])/, /^(?:$)/],
    conditions: {
      "INITIAL": {
        "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36],
        "inclusive": true
      }
    }
  };
  return lexer;
}();
parser.lexer = lexer;
function grammar_parser_Parser() {
  this.yy = {};
}
grammar_parser_Parser.prototype = parser;
parser.Parser = grammar_parser_Parser;
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/helper/string.mjs
/* eslint-disable import/prefer-default-export */

/**
 * Trim value by cutting character starting from the beginning and ending at the same time.
 *
 * @param {String} string String to trimming.
 * @param {Number} [margin=1] Number of character to cut.
 * @returns {String}
 */
function trimEdges(string) {
  var margin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  string = string.substring(margin, string.length - margin);
  return string;
}
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/helper/cell.mjs
function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || cell_unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function cell_unsupportedIterableToArray(o, minLen) {
  if (!o) return;
  if (typeof o === "string") return cell_arrayLikeToArray(o, minLen);
  var n = Object.prototype.toString.call(o).slice(8, -1);
  if (n === "Object" && o.constructor) n = o.constructor.name;
  if (n === "Map" || n === "Set") return Array.from(o);
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return cell_arrayLikeToArray(o, minLen);
}
function cell_arrayLikeToArray(arr, len) {
  if (len == null || len > arr.length) len = arr.length;
  for (var i = 0, arr2 = new Array(len); i < len; i++) {
    arr2[i] = arr[i];
  }
  return arr2;
}
function _iterableToArrayLimit(arr, i) {
  if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;
  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
      _arr.push(_s.value);
      if (i && _arr.length === i) break;
    }
  } catch (err) {
    _d = true;
    _e = err;
  } finally {
    try {
      if (!_n && _i["return"] != null) _i["return"]();
    } finally {
      if (_d) throw _e;
    }
  }
  return _arr;
}
function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}

/**
 * Convert row label to index.
 *
 * @param {String} label Row label (eq. '1', '5')
 * @returns {Number} Returns -1 if label is not recognized otherwise proper row index.
 */
function rowLabelToIndex(label) {
  var result = parseInt(label, 10);
  if (isNaN(result)) {
    result = -1;
  } else {
    result = Math.max(result - 1, -1);
  }
  return result;
}
/**
 * Convert row index to label.
 *
 * @param {Number} row Row index.
 * @returns {String} Returns row label (eq. '1', '7').
 */

function rowIndexToLabel(row) {
  var result = '';
  if (row >= 0) {
    result = "".concat(row + 1);
  }
  return result;
}
var COLUMN_LABEL_BASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var COLUMN_LABEL_BASE_LENGTH = COLUMN_LABEL_BASE.length;
/**
 * Convert column label to index.
 *
 * @param {String} label Column label (eq. 'ABB', 'CNQ')
 * @returns {Number} Returns -1 if label is not recognized otherwise proper column index.
 */

function columnLabelToIndex(label) {
  var result = 0;
  if (typeof label === 'string') {
    label = label.toUpperCase();
    for (var i = 0, j = label.length - 1; i < label.length; i += 1, j -= 1) {
      result += Math.pow(COLUMN_LABEL_BASE_LENGTH, j) * (COLUMN_LABEL_BASE.indexOf(label[i]) + 1);
    }
  }
  --result;
  return result;
}
/**
 * Convert column index to label.
 *
 * @param {Number} column Column index.
 * @returns {String} Returns column label (eq. 'ABB', 'CNQ').
 */

function columnIndexToLabel(column) {
  var result = '';
  while (column >= 0) {
    result = String.fromCharCode(column % COLUMN_LABEL_BASE_LENGTH + 97) + result;
    column = Math.floor(column / COLUMN_LABEL_BASE_LENGTH) - 1;
  }
  return result.toUpperCase();
}
var LABEL_EXTRACT_REGEXP = /^([$])?([A-Za-z]+)([$])?([0-9]+)$/;
/**
 * Extract cell coordinates.
 *
 * @param {String} label Cell coordinates (eq. 'A1', '$B6', '$N$98').
 * @returns {Array} Returns an array of objects.
 */

function extractLabel(label) {
  if (typeof label !== 'string' || !LABEL_EXTRACT_REGEXP.test(label)) {
    return [];
  }
  var _label$toUpperCase$ma = label.toUpperCase().match(LABEL_EXTRACT_REGEXP),
    _label$toUpperCase$ma2 = _slicedToArray(_label$toUpperCase$ma, 5),
    columnAbs = _label$toUpperCase$ma2[1],
    column = _label$toUpperCase$ma2[2],
    rowAbs = _label$toUpperCase$ma2[3],
    row = _label$toUpperCase$ma2[4];
  return [{
    index: rowLabelToIndex(row),
    label: row,
    isAbsolute: rowAbs === '$'
  }, {
    index: columnLabelToIndex(column),
    label: column,
    isAbsolute: columnAbs === '$'
  }];
}
/**
 * Convert row and column indexes into cell label.
 *
 * @param {Object} row Object with `index` and `isAbsolute` properties.
 * @param {Object} column Object with `index` and `isAbsolute` properties.
 * @returns {String} Returns cell label.
 */

function toLabel(row, column) {
  var rowLabel = (row.isAbsolute ? '$' : '') + rowIndexToLabel(row.index);
  var columnLabel = (column.isAbsolute ? '$' : '') + columnIndexToLabel(column.index);
  return columnLabel + rowLabel;
}
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/parser.mjs
function _typeof(obj) {
  "@babel/helpers - typeof";

  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof = function _typeof(obj) {
      return typeof obj;
    };
  } else {
    _typeof = function _typeof(obj) {
      return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    };
  }
  return _typeof(obj);
}
function parser_slicedToArray(arr, i) {
  return parser_arrayWithHoles(arr) || parser_iterableToArrayLimit(arr, i) || parser_unsupportedIterableToArray(arr, i) || parser_nonIterableRest();
}
function parser_nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function parser_unsupportedIterableToArray(o, minLen) {
  if (!o) return;
  if (typeof o === "string") return parser_arrayLikeToArray(o, minLen);
  var n = Object.prototype.toString.call(o).slice(8, -1);
  if (n === "Object" && o.constructor) n = o.constructor.name;
  if (n === "Map" || n === "Set") return Array.from(o);
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return parser_arrayLikeToArray(o, minLen);
}
function parser_arrayLikeToArray(arr, len) {
  if (len == null || len > arr.length) len = arr.length;
  for (var i = 0, arr2 = new Array(len); i < len; i++) {
    arr2[i] = arr[i];
  }
  return arr2;
}
function parser_iterableToArrayLimit(arr, i) {
  if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = undefined;
  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
      _arr.push(_s.value);
      if (i && _arr.length === i) break;
    }
  } catch (err) {
    _d = true;
    _e = err;
  } finally {
    try {
      if (!_n && _i["return"] != null) _i["return"]();
    } finally {
      if (_d) throw _e;
    }
  }
  return _arr;
}
function parser_arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}
function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties(target, props) {
  for (var i = 0; i < props.length; i++) {
    var descriptor = props[i];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor) descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass(Constructor, protoProps, staticProps) {
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  if (staticProps) _defineProperties(Constructor, staticProps);
  return Constructor;
}
function _inherits(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, {
    constructor: {
      value: subClass,
      writable: true,
      configurable: true
    }
  });
  if (superClass) _setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };
  return _setPrototypeOf(o, p);
}
function _createSuper(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf(Derived),
      result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn(this, result);
  };
}
function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized(self);
}
function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self;
}
function _isNativeReflectConstruct() {
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  if (Reflect.construct.sham) return false;
  if (typeof Proxy === "function") return true;
  try {
    Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
    return true;
  } catch (e) {
    return false;
  }
}
function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}







/**
 * @class Parser
 */

var Parser = /*#__PURE__*/function (_Emitter) {
  _inherits(Parser, _Emitter);
  var _super = _createSuper(Parser);
  function Parser() {
    var _this;
    _classCallCheck(this, Parser);
    _this = _super.call(this);
    _this.parser = new grammar_parser_Parser();
    _this.parser.yy = {
      toNumber: toNumber,
      trimEdges: trimEdges,
      invertNumber: invertNumber,
      throwError: function throwError(errorName) {
        return _this._throwError(errorName);
      },
      callVariable: function callVariable(variable) {
        return _this._callVariable(variable);
      },
      evaluateByOperator: evaluateByOperator,
      callFunction: function callFunction(name, params) {
        return _this._callFunction(name, params);
      },
      cellValue: function cellValue(value) {
        return _this._callCellValue(value);
      },
      rangeValue: function rangeValue(start, end) {
        return _this._callRangeValue(start, end);
      }
    };
    _this.variables = Object.create(null);
    _this.functions = Object.create(null);
    _this.setVariable('TRUE', true).setVariable('FALSE', false).setVariable('NULL', null);
    return _this;
  }
  /**
   * Parse formula expression.
   *
   * @param {String} expression to parse.
   * @return {*} Returns an object with tow properties `error` and `result`.
   */

  _createClass(Parser, [{
    key: "parse",
    value: function parse(expression) {
      var result = null;
      var error = null;
      try {
        if (expression === '') {
          result = '';
        } else {
          result = this.parser.parse(expression);
        }
      } catch (ex) {
        var message = error_error(ex.message);
        if (message) {
          error = message;
        } else {
          error = error_error(ERROR);
        }
      }
      if (result instanceof Error) {
        error = error_error(result.message) || error_error(ERROR);
        result = null;
      }
      return {
        error: error,
        result: result
      };
    }
    /**
     * Set predefined variable name which can be visible while parsing formula expression.
     *
     * @param {String} name Variable name.
     * @param {*} value Variable value.
     * @returns {Parser}
     */
  }, {
    key: "setVariable",
    value: function setVariable(name, value) {
      this.variables[name] = value;
      return this;
    }
    /**
     * Get variable name.
     *
     * @param {String} name Variable name.
     * @returns {*}
     */
  }, {
    key: "getVariable",
    value: function getVariable(name) {
      return this.variables[name];
    }
    /**
     * Retrieve variable value by its name.
     *
     * @param name Variable name.
     * @returns {*}
     * @private
     */
  }, {
    key: "_callVariable",
    value: function _callVariable(name) {
      var value = this.getVariable(name);
      this.emit('callVariable', name, function (newValue) {
        if (newValue !== void 0) {
          value = newValue;
        }
      });
      if (value === void 0) {
        throw Error(ERROR_NAME);
      }
      return value;
    }
    /**
     * Set custom function which can be visible while parsing formula expression.
     *
     * @param {String} name Custom function name.
     * @param {Function} fn Custom function.
     * @returns {Parser}
     */
  }, {
    key: "setFunction",
    value: function setFunction(name, fn) {
      this.functions[name] = fn;
      return this;
    }
    /**
     * Get custom function.
     *
     * @param {String} name Custom function name.
     * @returns {*}
     */
  }, {
    key: "getFunction",
    value: function getFunction(name) {
      return this.functions[name];
    }
    /**
     * Call function with provided params.
     *
     * @param name Function name.
     * @param params Function params.
     * @returns {*}
     * @private
     */
  }, {
    key: "_callFunction",
    value: function _callFunction(name) {
      var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
      var fn = this.getFunction(name);
      var value;
      if (fn) {
        value = fn(params);
      }
      this.emit('callFunction', name, params, function (newValue) {
        if (newValue !== void 0) {
          value = newValue;
        }
      });
      return value === void 0 ? evaluateByOperator(name, params) : value;
    }
    /**
     * Retrieve value by its label (`B3`, `B$3`, `B$3`, `$B$3`).
     *
     * @param {String} label Coordinates.
     * @returns {*}
     * @private
     */
  }, {
    key: "_callCellValue",
    value: function _callCellValue(label) {
      label = label.toUpperCase();
      var _extractLabel = extractLabel(label),
        _extractLabel2 = parser_slicedToArray(_extractLabel, 2),
        row = _extractLabel2[0],
        column = _extractLabel2[1];
      var value = void 0;
      this.emit('callCellValue', {
        label: label,
        row: row,
        column: column
      }, function (_value) {
        value = _value;
      });
      return value;
    }
    /**
     * Retrieve value by its label (`B3:A1`, `B$3:A1`, `B$3:$A1`, `$B$3:A$1`).
     *
     * @param {String} startLabel Coordinates of the first cell.
     * @param {String} endLabel Coordinates of the last cell.
     * @returns {Array} Returns an array of mixed values.
     * @private
     */
  }, {
    key: "_callRangeValue",
    value: function _callRangeValue(startLabel, endLabel) {
      startLabel = startLabel.toUpperCase();
      endLabel = endLabel.toUpperCase();
      var _extractLabel3 = extractLabel(startLabel),
        _extractLabel4 = parser_slicedToArray(_extractLabel3, 2),
        startRow = _extractLabel4[0],
        startColumn = _extractLabel4[1];
      var _extractLabel5 = extractLabel(endLabel),
        _extractLabel6 = parser_slicedToArray(_extractLabel5, 2),
        endRow = _extractLabel6[0],
        endColumn = _extractLabel6[1];
      var startCell = {};
      var endCell = {};
      if (startRow.index <= endRow.index) {
        startCell.row = startRow;
        endCell.row = endRow;
      } else {
        startCell.row = endRow;
        endCell.row = startRow;
      }
      if (startColumn.index <= endColumn.index) {
        startCell.column = startColumn;
        endCell.column = endColumn;
      } else {
        startCell.column = endColumn;
        endCell.column = startColumn;
      }
      startCell.label = toLabel(startCell.row, startCell.column);
      endCell.label = toLabel(endCell.row, endCell.column);
      var value = [];
      this.emit('callRangeValue', startCell, endCell, function () {
        var _value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
        value = _value;
      });
      return value;
    }
    /**
     * Try to throw error by its name.
     *
     * @param {String} errorName Error name.
     * @returns {String}
     * @private
     */
  }, {
    key: "_throwError",
    value: function _throwError(errorName) {
      if (isValidStrict(errorName)) {
        throw Error(errorName);
      }
      throw Error(ERROR);
    }
  }]);
  return Parser;
}(tiny_emitter);
/* harmony default export */ const hot_formula_parser_parser = (Parser);
;// CONCATENATED MODULE: ./node_modules/hot-formula-parser/index.mjs





;// CONCATENATED MODULE: ./packages/utils/number.js



const formulaParser = new hot_formula_parser_parser();
/* harmony default export */ const number = ({
  truncate(num, digits) {
    if (num < 0) {
      let rnum = '-' + xe_utils_default().floor(String(num).replace('-', ''), digits);
      return Number(rnum);
    } else {
      return xe_utils_default().floor(num, digits);
    }
  },
  calculate(formula, data) {
    if (!formula) return '';
    if (data && xe_utils_default().isPlainObject(data)) {
      formula = string.format(formula, data, true);
    }
    let {
      result
    } = formulaParser.parse(formula);
    return result;
  }
});
;// CONCATENATED MODULE: ./packages/utils/boolean.js

/* harmony default export */ const utils_boolean = ({
  isPromise(obj) {
    return Object.prototype.toString.call(obj).slice(8, -1) === 'Promise';
  },
  isNone(value) {
    return ['', null, undefined].includes(value);
  }
});
;// CONCATENATED MODULE: ./packages/utils/color.js
/* provided dependency */ var console = __webpack_require__(3639);
const colorKeywords = new Map([['transparent', 'rgba(0,0,0,0)'], ['black', '#000000'], ['silver', '#C0C0C0'], ['gray', '#808080'], ['white', '#FFFFFF'], ['maroon', '#800000'], ['red', '#FF0000'], ['purple', '#722ed1'], ['fuchsia', '#FF00FF'], ['green', '#52c41a'], ['lime', '#a0d911'], ['olive', '#808000'], ['yellow', '#fadb14'], ['navy', '#000080'], ['blue', '#1890ff'], ['teal', '#008080'], ['aqua', '#00FFFF'], ['aliceblue', '#f0f8ff'], ['antiquewhite', '#faebd7'], ['aquamarine', '#7fffd4'], ['azure', '#f0ffff'], ['beige', '#f5f5dc'], ['bisque', '#ffe4c4'], ['blanchedalmond', '#ffebcd'], ['blueviolet', '#8a2be2'], ['brown', '#a52a2a'], ['burlywood', '#deb887'], ['cadetblue', '#5f9ea0'], ['chartreuse', '#7fff00'], ['chocolate', '#d2691e'], ['coral', '#ff7f50'], ['cornflowerblue', '#6495ed'], ['cornsilk', '#fff8dc'], ['crimson', '#dc143c'], ['cyan', '#13c2c2'], ['darkblue', '#00008b'], ['darkcyan', '#008b8b'], ['darkgoldenrod', '#b8860b'], ['darkgray', '#a9a9a9'], ['darkgreen', '#006400'], ['darkgrey', '#a9a9a9'], ['darkkhaki', '#bdb76b'], ['darkmagenta', '#8b008b'], ['darkolivegreen', '#556b2f'], ['darkorange', '#ff8c00'], ['darkorchid', '#9932cc'], ['darkred', '#8b0000'], ['darksalmon', '#e9967a'], ['darkseagreen', '#8fbc8f'], ['darkslateblue', '#483d8b'], ['darkslategray', '#2f4f4f'], ['darkslategrey', '#2f4f4f'], ['darkturquoise', '#00ced1'], ['darkviolet', '#9400d3'], ['deeppink', '#ff1493'], ['deepskyblue', '#00bfff'], ['dimgray', '#696969'], ['dimgrey', '#696969'], ['dodgerblue', '#1e90ff'], ['firebrick', '#b22222'], ['floralwhite', '#fffaf0'], ['forestgreen', '#228b22'], ['gainsboro', '#dcdcdc'], ['geekblue', '#2f54eb'], ['ghostwhite', '#f8f8ff'], ['gold', '#faad14'], ['goldenrod', '#daa520'], ['greenyellow', '#adff2f'], ['grey', '#808080'], ['honeydew', '#f0fff0'], ['hotpink', '#ff69b4'], ['indianred', '#cd5c5c'], ['indigo', '#4b0082'], ['ivory', '#fffff0'], ['khaki', '#f0e68c'], ['lavender', '#e6e6fa'], ['lavenderblush', '#fff0f5'], ['lawngreen', '#7cfc00'], ['lemonchiffon', '#fffacd'], ['lightblue', '#add8e6'], ['lightcoral', '#f08080'], ['lightcyan', '#e0ffff'], ['lightgoldenrodyellow', '#fafad2'], ['lightgray', '#d3d3d3'], ['lightgreen', '#90ee90'], ['lightgrey', '#d3d3d3'], ['lightpink', '#ffb6c1'], ['lightsalmon', '#ffa07a'], ['lightseagreen', '#20b2aa'], ['lightskyblue', '#87cefa'], ['lightslategray', '#778899'], ['lightslategrey', '#778899'], ['lightsteelblue', '#b0c4de'], ['lightyellow', '#ffffe0'], ['limegreen', '#32cd32'], ['linen', '#faf0e6'], ['magenta', '#eb2f96'], ['mediumaquamarine', '#66cdaa'], ['mediumblue', '#0000cd'], ['mediumorchid', '#ba55d3'], ['mediumpurple', '#9370db'], ['mediumseagreen', '#3cb371'], ['mediumslateblue', '#7b68ee'], ['mediumspringgreen', '#00fa9a'], ['mediumturquoise', '#48d1cc'], ['mediumvioletred', '#c71585'], ['midnightblue', '#191970'], ['mintcream', '#f5fffa'], ['mistyrose', '#ffe4e1'], ['moccasin', '#ffe4b5'], ['navajowhite', '#ffdead'], ['oldlace', '#fdf5e6'], ['olivedrab', '#6b8e23'], ['orange', '#fa8c16'], ['orangered', '#ff4500'], ['orchid', '#da70d6'], ['palegoldenrod', '#eee8aa'], ['palegreen', '#98fb98'], ['paleturquoise', '#afeeee'], ['palevioletred', '#db7093'], ['papayawhip', '#ffefd5'], ['peachpuff', '#ffdab9'], ['peru', '#cd853f'], ['pink', '#ffc0cb'], ['plum', '#dda0dd'], ['powderblue', '#b0e0e6'], ['rosybrown', '#bc8f8f'], ['royalblue', '#4169e1'], ['saddlebrown', '#8b4513'], ['salmon', '#fa8072'], ['sandybrown', '#f4a460'], ['seagreen', '#2e8b57'], ['seashell', '#fff5ee'], ['sienna', '#a0522d'], ['skyblue', '#87ceeb'], ['slateblue', '#6a5acd'], ['slategray', '#708090'], ['slategrey', '#708090'], ['snow', '#fffafa'], ['springgreen', '#00ff7f'], ['steelblue', '#4682b4'], ['tan', '#d2b48c'], ['thistle', '#d8bfd8'], ['tomato', '#ff6347'], ['turquoise', '#40e0d0'], ['violet', '#ee82ee'], ['volcano', '#fa541c'], ['wheat', '#f5deb3'], ['whitesmoke', '#f5f5f5'], ['yellowgreen', '#9acd32']]);
const hexReg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
const rgbReg = /^(rgb|rgba|RGB|RGBA)/;
const rgbaReg = /^(rgba|RGBA)/;

/**
 * @description Color validator
 * @param {String} color Hex|Rgb|Rgba color or color keyword
 * @return {String|Boolean} Valid color Or false
 */
function validator(color) {
  const isHex = hexReg.test(color);
  const isRgb = rgbReg.test(color);
  if (isHex || isRgb) return color;
  color = getColorByKeyword(color);
  if (!color) {
    console.error('Color: Invalid color!');
    return false;
  }
  return color;
}

/**
 * @description Get color by keyword
 * @param {String} keyword Color keyword like red, green and etc.
 * @return {String|Boolean} Hex or rgba color (Invalid keyword will return false)
 */
function getColorByKeyword(keyword) {
  if (!keyword) {
    console.error('getColorByKeywords: Missing parameters!');
    return false;
  }
  if (!colorKeywords.has(keyword)) return false;
  return colorKeywords.get(keyword);
}

/**
 * @description Get the Rgb value of the color
 * @param {String} color Hex|Rgb|Rgba color or color keyword
 * @return {Array<Number>|Boolean} Rgb value of the color (Invalid input will return false)
 */
function getRgbValue(color) {
  if (!color) {
    console.error('getRgbValue: Missing parameters!');
    return false;
  }
  color = validator(color);
  if (!color) return false;
  const isHex = hexReg.test(color);
  const isRgb = rgbReg.test(color);
  const lowerColor = color.toLowerCase();
  if (isHex) return getRgbValueFromHex(lowerColor);
  if (isRgb) return getRgbValueFromRgb(lowerColor);
}

/**
 * @description Get the rgb value of the hex color
 * @param {String} color Hex color
 * @return {Array<Number>} Rgb value of the color
 */
function getRgbValueFromHex(color) {
  color = color.replace('#', '');
  if (color.length === 3) color = Array.from(color).map(hexNum => hexNum + hexNum).join('');
  color = color.split('');
  return new Array(3).fill(0).map((t, i) => parseInt(`0x${color[i * 2]}${color[i * 2 + 1]}`));
}

/**
 * @description Get the rgb value of the rgb/rgba color
 * @param {String} color Hex color
 * @return {Array} Rgb value of the color
 */
function getRgbValueFromRgb(color) {
  return color.replace(/rgb\(|rgba\(|\)/g, '').split(',').slice(0, 3).map(n => parseInt(n));
}

/**
 * @description Get the Rgba value of the color
 * @param {String} color Hex|Rgb|Rgba color or color keyword
 * @return {Array<Number>|Boolean} Rgba value of the color (Invalid input will return false)
 */
function getRgbaValue(color) {
  if (!color) {
    console.error('getRgbaValue: Missing parameters!');
    return false;
  }
  const colorValue = getRgbValue(color);
  if (!colorValue) return false;
  colorValue.push(getOpacity(color));
  return colorValue;
}

/**
 * @description Get the opacity of color
 * @param {String} color Hex|Rgb|Rgba color or color keyword
 * @return {Number|Boolean} Color opacity (Invalid input will return false)
 */
function getOpacity(color) {
  if (!color) {
    console.error('getOpacity: Missing parameters!');
    return false;
  }
  color = validator(color);
  if (!color) return false;
  const isRgba = rgbaReg.test(color);
  if (!isRgba) return 1;
  color = color.toLowerCase();
  return Number(color.split(',').slice(-1)[0].replace(/[)|\s]/g, ''));
}

/**
 * @description Convert color to Rgb|Rgba color
 * @param {String} color   Hex|Rgb|Rgba color or color keyword
 * @param {Number} opacity The opacity of color
 * @return {String|Boolean} Rgb|Rgba color (Invalid input will return false)
 */
function toRgb(color, opacity) {
  if (!color) {
    console.error('toRgb: Missing parameters!');
    return false;
  }
  const rgbValue = getRgbValue(color);
  if (!rgbValue) return false;
  const addOpacity = typeof opacity === 'number';
  if (addOpacity) return 'rgba(' + rgbValue.join(',') + `,${opacity})`;
  return 'rgb(' + rgbValue.join(',') + ')';
}

/**
 * @description Convert color to Hex color
 * @param {String} color Hex|Rgb|Rgba color or color keyword
 * @return {String|Boolean} Hex color (Invalid input will return false)
 */
function toHex(color) {
  if (!color) {
    console.error('toHex: Missing parameters!');
    return false;
  }
  if (hexReg.test(color)) return color;
  color = getRgbValue(color);
  if (!color) return false;
  return '#' + color.map(n => Number(n).toString(16)).map(n => n === '0' ? '00' : n).join('');
}

/**
 * @description Get Color from Rgb|Rgba value
 * @param {Array<Number>} value Rgb|Rgba color value
 * @return {String|Boolean} Rgb|Rgba color (Invalid input will return false)
 */
function getColorFromRgbValue(value) {
  if (!value) {
    console.error('getColorFromRgbValue: Missing parameters!');
    return false;
  }
  const valueLength = value.length;
  if (valueLength !== 3 && valueLength !== 4) {
    console.error('getColorFromRgbValue: Value is illegal!');
    return false;
  }
  let color = valueLength === 3 ? 'rgb(' : 'rgba(';
  color += value.join(',') + ')';
  return color;
}

/**
 * @description Deepen color
 * @param {String} color Hex|Rgb|Rgba color or color keyword
 * @return {Number} Percent of Deepen (1-100)
 * @return {String|Boolean} Rgba color (Invalid input will return false)
 */
function darken(color, percent = 0) {
  if (!color) {
    console.error('darken: Missing parameters!');
    return false;
  }
  let rgbaValue = getRgbaValue(color);
  if (!rgbaValue) return false;
  rgbaValue = rgbaValue.map((v, i) => i === 3 ? v : v - Math.ceil(2.55 * percent)).map(v => v < 0 ? 0 : v);
  return getColorFromRgbValue(rgbaValue);
}

/**
 * @description Brighten color
 * @param {String} color Hex|Rgb|Rgba color or color keyword
 * @return {Number} Percent of brighten (1-100)
 * @return {String|Boolean} Rgba color (Invalid input will return false)
 */
function lighten(color, percent = 0) {
  if (!color) {
    console.error('lighten: Missing parameters!');
    return false;
  }
  let rgbaValue = getRgbaValue(color);
  if (!rgbaValue) return false;
  rgbaValue = rgbaValue.map((v, i) => i === 3 ? v : v + Math.ceil(2.55 * percent)).map(v => v > 255 ? 255 : v);
  return getColorFromRgbValue(rgbaValue);
}

/**
 * @description Adjust color opacity
 * @param {String} color   Hex|Rgb|Rgba color or color keyword
 * @param {Number} percent of opacity
 * @return {String|Boolean} Rgba color (Invalid input will return false)
 */
function fade(color, percent = 100) {
  if (!color) {
    console.error('fade: Missing parameters!');
    return false;
  }
  const rgbValue = getRgbValue(color);
  if (!rgbValue) return false;
  const rgbaValue = [...rgbValue, percent / 100];
  return getColorFromRgbValue(rgbaValue);
}
/* harmony default export */ const color = ({
  fade,
  toHex,
  toRgb,
  darken,
  lighten,
  getOpacity,
  getRgbValue,
  getRgbaValue,
  getColorFromRgbValue
});
;// CONCATENATED MODULE: ./packages/utils/dom.js
const getScrollEventTarget = element => {
  let currentNode = element;
  while (currentNode && currentNode.tagName !== 'HTML' && currentNode.nodeType === 1) {
    const overflowY = window.getComputedStyle(currentNode).overflowY;
    if (overflowY === 'scroll' || overflowY === 'auto') {
      return currentNode;
    }
    currentNode = currentNode.parentNode;
  }
  return window;
};
const getScrollTop = element => {
  if (element === window) {
    return Math.max(window.pageYOffset || 0, document.documentElement.scrollTop);
  } else {
    return element.scrollTop;
  }
};
const getOffset = el => {
  const box = el.getBoundingClientRect();
  const body = document.body;
  const clientTop = el.clientTop || body.clientTop || 0;
  const clientLeft = el.clientLeft || body.clientLeft || 0;
  const scrollTop = window.pageYOffset || el.scrollTop;
  const scrollLeft = window.pageXOffset || el.scrollLeft;
  return {
    top: box.top + scrollTop - clientTop,
    left: box.left + scrollLeft - clientLeft
  };
};
const transitionEnd = (el, fun) => {
  const arr = ['msTransitionEnd', 'mozTransitionEnd', 'oTransitionEnd', 'webkitTransitionEnd', 'transitionend'];
  const handler = {
    handleEvent(event) {
      arr.forEach(function (eventName) {
        el.removeEventListener(eventName, handler, false);
      });
      fun.apply(el, arguments);
    }
  };
  arr.forEach(function (eventName) {
    el.addEventListener(eventName, handler, false);
  });
};
const hasClass = (el, cls) => {
  if (!el || !cls) return false;
  if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.');
  if (el.classList) {
    return el.classList.contains(cls);
  } else {
    return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
  }
};
const addClass = (el, cls) => {
  if (!el) return;
  var curClass = el.className;
  var classes = (cls || '').split(' ');
  for (var i = 0, j = classes.length; i < j; i++) {
    var clsName = classes[i];
    if (!clsName) continue;
    if (el.classList) {
      el.classList.add(clsName);
    } else {
      if (!hasClass(el, clsName)) {
        curClass += ' ' + clsName;
      }
    }
  }
  if (!el.classList) {
    el.className = curClass;
  }
};
const removeClass = (el, cls) => {
  if (!el || !cls) return;
  var classes = cls.split(' ');
  var curClass = ' ' + el.className + ' ';
  for (var i = 0, j = classes.length; i < j; i++) {
    var clsName = classes[i];
    if (!clsName) continue;
    if (el.classList) {
      el.classList.remove(clsName);
    } else {
      if (hasClass(el, clsName)) {
        curClass = curClass.replace(' ' + clsName + ' ', ' ');
      }
    }
  }
  if (!el.classList) {
    el.className = curClass ? curClass.trim() : curClass;
  }
};

/**
 * @description 绑定事件 on(element, event, handler)
 */
const onListener = function () {
  if (document.addEventListener) {
    return function (element, event, handler) {
      if (element && event && handler) {
        element.addEventListener(event, handler, false);
      }
    };
  } else {
    return function (element, event, handler) {
      if (element && event && handler) {
        element.attachEvent('on' + event, handler);
      }
    };
  }
}();

/**
 * @description 解绑事件 off(element, event, handler)
 */
const offListener = function () {
  if (document.removeEventListener) {
    return function (element, event, handler) {
      if (element && event) {
        element.removeEventListener(event, handler, false);
      }
    };
  } else {
    return function (element, event, handler) {
      if (element && event) {
        element.detachEvent('on' + event, handler);
      }
    };
  }
}();
/* harmony default export */ const dom = ({
  getScrollEventTarget,
  getScrollTop,
  getOffset,
  transitionEnd,
  hasClass,
  addClass,
  removeClass,
  onListener,
  offListener
});
;// CONCATENATED MODULE: ./packages/utils/other.js

/* harmony default export */ const other = ({
  toDateDiffText(date) {
    let currDate = 1544407800000; // '2018-12-10 10:10:00'
    let dateDiff = xe_utils_default().getDateDiff(date, currDate);
    if (dateDiff.done) {
      if (dateDiff.time < 10000) {
        return '刚刚';
      } else if (dateDiff.time < 60000) {
        return `${dateDiff.ss}秒之前`;
      } else if (dateDiff.time < 360000) {
        return `${dateDiff.mm}分钟之前`;
      } else if (dateDiff.time < 86400000) {
        return `${dateDiff.HH}小时之前`;
      } else if (dateDiff.time < 2592000000) {
        return `${dateDiff.dd}天之前`;
      } else if (dateDiff.time < 31536000000) {
        return `${dateDiff.MM}个月之前`;
      }
      return `${dateDiff.yyyy}年之前`;
    }
    return '错误类型';
  },
  ioToFile(io, fileName = 'download', type = 'blob') {
    return new Promise((resolve, reject) => {
      try {
        if ('download' in document.createElement('a')) {
          // 非IE下载
          const elink = document.createElement('a');
          const url = window.URL || window.webkitURL || window.moxURL;
          elink.style.display = 'none';
          elink.href = url.createObjectURL(io);
          elink.download = fileName;
          elink.click();
          url.revokeObjectURL(elink.href);
        } else {
          // IE10+下载
          navigator.msSaveBlob(io, fileName);
        }
        resolve();
      } catch (e) {
        reject(e);
      }
    });
  },
  // 数字金额转大写
  toMoneyChies(val, option = {}) {
    let {
      upcase = true
    } = option;
    //汉字的数字
    var cnNums = upcase ? ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'] : ['零', '一', '二', '三', '四', '伍', '六', '七', '八', '九'];
    //基本单位
    var cnIntRadice = ['', '拾', '佰', '仟'];
    //对应整数部分扩展单位
    var cnIntUnits = ['', '万', '亿', '兆'];
    //对应小数部分单位
    var cnDecUnits = ['角', '分', '毫', '厘'];
    //整数金额时后面跟的字符
    var cnInteger = '整';
    //整型完以后的单位
    var cnIntLast = '元';
    //最大处理的数字
    var maxNum = 999999999999999.9999;
    //金额整数部分
    var integerNum;
    //金额小数部分
    var decimalNum;
    //输出的中文金额字符串
    var chineseStr = '';
    //分离金额后用的数组，预定义
    var parts;
    if (val === '') return val;
    val = parseFloat(val);
    if (val >= maxNum) {
      //超出最大处理数字
      return '';
    }
    if (val === 0) {
      chineseStr = cnNums[0] + cnIntLast + cnInteger;
      return chineseStr;
    }
    //转换为字符串
    val = val.toString();
    if (val.indexOf('.') === -1) {
      integerNum = val;
      decimalNum = '';
    } else {
      parts = val.split('.');
      integerNum = parts[0];
      decimalNum = parts[1].substr(0, 4);
    }
    //获取整型部分转换
    if (parseInt(integerNum, 10) > 0) {
      var zeroCount = 0;
      var IntLen = integerNum.length;
      for (let i = 0; i < IntLen; i++) {
        let n = integerNum.substr(i, 1);
        var p = IntLen - i - 1;
        var q = p / 4;
        var m = p % 4;
        if (n === '0') {
          zeroCount++;
        } else {
          if (zeroCount > 0) {
            chineseStr += cnNums[0];
          }
          //归零
          zeroCount = 0;
          chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
        }
        if (m === 0 && zeroCount < 4) {
          chineseStr += cnIntUnits[q];
        }
      }
      chineseStr += cnIntLast;
    }
    //小数部分
    if (decimalNum !== '') {
      var decLen = decimalNum.length;
      for (var i = 0; i < decLen; i++) {
        var n = decimalNum.substr(i, 1);
        if (n !== '0') {
          chineseStr += cnNums[Number(n)] + cnDecUnits[i];
        }
      }
    }
    if (chineseStr === '') {
      chineseStr += cnNums[0] + cnIntLast + cnInteger;
    } else if (decimalNum === '') {
      chineseStr += cnInteger;
    }
    return chineseStr;
  },
  // 补全金额位数，返回字符串
  formatMoneyPad(value) {
    //基本单位
    let cnIntRadice = ['亿', '千', '百', '十', '万', '千', '百', '十', '元'];
    // 小数单位
    let cnDecUnits = ['角', '分', '毫', '厘'];
    let intValue = String(value).split('.')[0] || '';
    let decValue = String(value).split('.')[1] || '';
    let intFixed = intValue.padStart(cnIntRadice.length, ' ');
    let decFixed = decValue.padEnd(cnDecUnits.length, '0');
    return intFixed + '.' + decFixed;
  },
  // 封装 系统内对渲染器格式化方法
  formatRender(value, key, rowData, renderName, renderProps, renderContext, editable) {
    // editable: 是否对返回值进行修正 默认 否
    let rvalue, rtext, rname;
    let {
      $vUtils,
      $vxePluginNames
    } = renderContext;
    let {
      min,
      max,
      digits,
      type,
      multiple,
      split,
      range,
      options,
      format,
      nodeKey,
      labelField,
      moneyUnit,
      commafy,
      openValue,
      openLabel,
      closeValue,
      closeLabel,
      bill,
      defaultValue
    } = renderProps;
    let defaultDateFormat = {
      date: 'yyyy-MM-dd',
      time: 'HH:mm:ss',
      datetime: 'yyyy-MM-dd HH:mm:ss',
      month: 'yyyy-MM',
      week: 'yyyy-MM-dd',
      year: 'yyyy'
    };
    if (renderName === '$vRowCell') {
      let field = rowData[key + 'field'] || key;
      rname = rowData[field + 'RenderName'] || '$vInput';
    } else {
      rname = renderName;
    }
    // 对于多选获取数组类型值进行解析 赋值
    let oriArray = [];
    // 配置公式，优先取解析后的嵌套公式
    let formula = $vUtils.get(renderProps, `formulaMap.${key}`) || renderProps.formula;
    // 进行默认赋值 若没有任何解析原数返回
    rvalue = value;
    if (!$vUtils.isNone(defaultValue) && $vUtils.isNone(value)) {
      rvalue = defaultValue;
    }
    // 自定渲染器进行解析与重新赋值
    switch (rname) {
      case '$vInput':
      case '$vMoney':
        let isNumberType = rname === '$vMoney' || ['integer', 'number', 'float'].includes(type);
        if (editable && isNumberType && !$vUtils.isNone(value)) {
          if ($vUtils.isNumber(+max) && +value > +max) {
            value = +max;
          } else if ($vUtils.isNumber(+min) && +value < +min) {
            value = +min;
          }
        }
        // 首先提取公式进行公式计算
        if (formula) {
          rvalue = $vUtils.calculate(formula, rowData);
        } else if (!$vUtils.isNone(value) && ['integer'].includes(type)) {
          rvalue = $vUtils.toInteger(value);
        } else if (!$vUtils.isNone(value) && ['number', 'float'].includes(type)) {
          rvalue = $vUtils.truncate(value, digits);
        }
        if (rname === '$vMoney' && !$vUtils.isNone(rvalue)) {
          rtext = $vUtils.truncate($vUtils.divide(rvalue, moneyUnit), digits);
        } else if (rname === '$vInput' && format) {
          rtext = $vUtils.format(format, rowData);
        }
        if (commafy && !bill && bill !== '0') {
          rtext = $vUtils.commafy(rtext, {
            digits
          }).replace(/0+$/, '').replace(/\.+$/, '');
        }
        break;
      case '$vTime':
        format = format ? format.replace('YYYY', 'yyyy').replace('DD', 'dd').replace('hh', 'HH') : defaultDateFormat[type];
        if ($vUtils.isNumber(value)) value = String(value);
        if (!$vUtils.isNone(value) && format) {
          rvalue = $vUtils.toDateString(value, format);
        }
        break;
      case '$vSelect':
      case '$vCheckgroup':
      case '$vRadiogroup':
      case '$vUpload':
      case '$vTree':
        let prefixKey = key.endsWith('Id') ? String(key).replace('Id', '') : key;
        let isMutiple = multiple || ['$vCheckgroup', '$vUpload'].includes(rname);
        let optionValue = 'value';
        let optionLabel = 'label';
        if (rname === '$vTree') {
          optionValue = nodeKey || 'id';
          if (labelField) optionLabel = labelField;
        }
        if (isMutiple) {
          if (Array.isArray(value)) {
            oriArray = value;
          } else if (!$vUtils.isNone(value)) {
            oriArray = String(value).split(split).filter(_ => _ && _ !== 'undefined');
          }
          if (options && options.length) {
            let rns = oriArray.map(orv => {
              let valueOption = options.find(option => $vUtils.isEqual(option[optionValue], orv));
              return valueOption ? valueOption[optionLabel] : '';
            });
            rtext = rns.join(split);
          }
          rvalue = oriArray;
        } else {
          if (options && options.length) {
            let valueOption = options.find(option => $vUtils.isEqual(option[optionValue], value));
            rtext = valueOption ? valueOption[optionLabel] : '';
          }
        }
        if (format) {
          let dataformat = format.replace(/@/gi, prefixKey);
          rtext = $vUtils.format(dataformat, rowData);
        }
        break;
      case '$vProgress':
        if (!$vUtils.isNone(value)) rvalue = $vUtils.truncate(value, digits);
        break;
      case '$vSwitch':
        if ($vUtils.isEqual(value, openValue)) {
          rtext = openLabel;
        } else if ($vUtils.isEqual(value, closeValue)) {
          rtext = closeLabel;
        }
        break;
    }
    if ($vUtils.isString(rvalue)) {
      rvalue = $vUtils.replaceNutrim(rvalue);
    }
    if ($vUtils.isNone(rtext) && !$vUtils.isNone(rvalue)) {
      rtext = rvalue;
    }
    return {
      rvalue,
      rtext
    };
  }
});
;// CONCATENATED MODULE: ./packages/utils/validate.js
/* harmony default export */ const validate = ({
  // 全局用户账号规则验证
  isValUsername(value) {
    const reg = /^\S*$/;
    if (!value) {
      return new Error('用户名不能为空');
    } else if (!reg.test(value)) {
      return new Error('用户名内不能包含空格');
    } else if (value.length > 16) {
      return new Error('请输入不超过16位用户账号');
    } else if (value.length < 6) {
      return new Error('请输入大于6位用户账号');
    }
    return true;
  },
  // 全局真实姓名规则验证
  isValUserRealname(value) {
    const reg = /^[\u4e00-\u9fa5]*$/;
    if (!value) {
      return new Error('姓名不能为空');
    } else if (value.length < 2) {
      return new Error('请输入大于2位用户姓名');
    } else if (!reg.test(value)) {
      return new Error('姓名请输入汉字');
    }
    return true;
  },
  // 用户密码规则验证
  isValPassword(value) {
    const reg = /^\S*$/;
    if (!value) {
      return new Error('密码不能为空');
    } else if (!reg.test(value)) {
      return new Error('密码不能包含空格');
    } else if (value.length > 16) {
      return new Error('请输入不超过16位密码');
    } else if (value.length < 6) {
      return new Error('请输入大于6位用户密码');
    }
    return true;
  },
  // 手机号验证
  isValMobile(value) {
    const reg = /^1[0-9]{10}$/;
    if (!value) {
      return new Error('联系方式不能为空');
    } else if (!reg.test(value)) {
      return new Error('请输入正确的联系方式');
    }
    return true;
  },
  // QQ号码验证
  isValQq(value) {
    const reg = /^[1-9][0-9]{4,10}$/;
    if (!value) {
      return new Error('QQ号不能为空');
    } else if (!reg.test(value)) {
      return new Error('请输入正确的QQ号');
    }
    return true;
  },
  // 身份证验证
  isValIdCode(value) {
    const reg = /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
    if (!value) {
      return new Error('身份证号不能为空');
    } else if (!reg.test(value)) {
      return new Error('请输入真实身份证！');
    }
    return true;
  },
  // 邮编验证
  isValEmail(value) {
    const reg = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
    if (!value) {
      return new Error('邮箱不能为空');
    } else if (!reg.test(value)) {
      return new Error('请输入正确的邮箱');
    }
    return true;
  },
  // 邮编验证
  isValPostcode(value) {
    const reg = /^[0-9]{6}$/;
    if (!value) {
      return new Error('邮编不能为空');
    } else if (!reg.test(value)) {
      return new Error('请输入正确的邮编');
    }
    return true;
  },
  // 钱币验证
  isValMoney(value) {
    const reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
    if (!value) {
      return new Error('金额不能为空');
    } else if (!reg.test(value)) {
      return new Error('请输入正确的金额！');
    }
    return true;
  },
  // 数字验证
  isValNumber(value) {
    const reg = /^[0-9]*[1-9][0-9]*$/;
    if (!value) {
      return new Error('请输入数字');
    } else if (!(reg.test(value) || Number(value) === 0)) {
      return new Error('请输入正整数');
    }
    return true;
  },
  // 数字、字母验证
  isValNumletter(value) {
    const reg = /^[0-9a-zA-Z]*$/;
    if (!value) {
      return new Error('请输入');
    } else if (!reg.test(value)) {
      return new Error('请输入数字或字母');
    }
    return true;
  },
  // 汉字验证
  isValChinese(value) {
    const reg = /^[\u4e00-\u9fa5]*$/;
    if (!value) {
      return new Error('请输入');
    } else if (!reg.test(value)) {
      return new Error('请输入汉字');
    }
    return true;
  },
  // 非空验证
  isValEmpty(value) {
    if (!value) {
      return new Error('请输入');
    }
    return true;
  }
});
;// CONCATENATED MODULE: ./packages/utils/pattern.js
/* harmony default export */ const pattern = ({
  numberReg() {
    return {
      number: /^[0-9]*$/,
      // 数字
      numberX: /^\d{n}$/,
      // n位的数字
      numberMinx: /^\d{n,}$/,
      // 至少n位的数字
      numberMn: /^\d{m,n}$/,
      // m-n位的数字
      numberFloat: /^(-)?\d+(\.\d{1,2})$/,
      // 带1-2位小数的正数或负数
      numberC: /^(-|\+)?\d+(\.\d+)?$/,
      // 正数、负数、和小数
      numberFloatZ: /^[0-9]+(\.[0-9]{2})?$/,
      // 有两位小数的正实数
      numberZhengZ: /^\+?[1-9][0-9]*$/,
      // 非零的正整数
      numberZhengF: /^-[1-9]\d*$/,
      // 非零的负整数
      numberFix: /^(-?\d+)(\.\d+)?$/,
      // 浮点数
      numberFixZ: /^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$/,
      // 正浮点数
      numberFixF: /^-([1-9]\d*\.\d*|0\.\d*[1-9]\d*)$/ // 负浮点数
    };
  },

  stringReg() {
    return {
      stringChinese: /^[\u4e00-\u9fa5]{0,}$/i,
      // 汉字
      stringEngNum: /^[A-Za-z0-9]+$/i,
      // 汉字
      stringMn: /^.{3,20}$/i,
      // 长度为m-n的所有字符
      stringEng: /^[A-Za-z]+$/i,
      // 字母
      stringEngUp: /^[A-Z]+$/i,
      // 大写字母
      stringEngLow: /^[a-z]+$/i // 小写字母
    };
  },

  mainReg() {
    return {
      email: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
      // 邮箱
      www: /^[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/,
      // 域名
      url: /^http[s]{0,1}:\/\/.+$/,
      // url
      phone: /^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/,
      // 手机号码
      tel: /^([0-9]{3,4}-)?[0-9]{7,8}$/,
      // 固定电话
      telphone: /^(1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8})|(([0-9]{3,4}-)?[0-9]{7,8})$/,
      // 手机号码与固定电话
      idcard: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
      // 身份证号
      postcode: /^[1-9]\d{5}(?!\d)$/,
      // 邮编
      qq: /^(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)$/,
      // qq
      space: /(^\s*)|(\s*$)/g,
      // 前后空格
      spaceAll: /^\s+|\s+$/g // 含有空格
    };
  }
});
;// CONCATENATED MODULE: ./packages/utils/index.js

xe_utils_default().setup({});









xe_utils_default().mixin({
  ...array,
  ...number,
  ...string,
  ...utils_boolean,
  ...color,
  ...dom,
  ...other,
  ...validate,
  ...pattern
});
/* harmony default export */ const utils = ((xe_utils_default()));
;// CONCATENATED MODULE: ./packages/index.js



;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib-no-default.js



})();

module.exports = __webpack_exports__;
/******/ })()
;